From nobody Sun Jul 13 07:27:32 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bfxqT4Lsdz61pZF; Sun, 13 Jul 2025 07:27:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bfxqS6v9qz3H32; Sun, 13 Jul 2025 07:27:32 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1752391653; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=UUZX22YsYTKrtWv7z4EPRWKU6yx9EJv02F0KO2W1F4A=; b=f9AE8cGtK1cUTBBdcTDWq3yh63qu5/zs0nZLY5guxXKSS8BW8fc7PuKMW8XxL4+EyWx4s7 XU0iwUZ4RT2An746LScUWVuDldFS8PFqyDtwzTI9aEYOVJ37c1+hPF+NW3Y7qnzvL3XFyP Lzygc9GKwjxHrTNWsk3D7srhyasHl2p1F7bNX0c8gVsobIuO0LKcdNm6UULCQiNdEbS5n8 NK6b0fiUZplEP78t0VQ2QXvxYE7QGfFhdKjf8qgD99WqBgBTSsIfF/kN9GEBZUJVkInDwN WXbkvzbRWry4cIO/voS7xBH1uf7hm47nLUzrtmdtTxcTvFCUO7Tgqu6BULVqiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1752391653; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=UUZX22YsYTKrtWv7z4EPRWKU6yx9EJv02F0KO2W1F4A=; b=MostrwYAuLtRWNATFLA+H0FZo0e0ZMkRniArI3h5nPEeGHetADWOvmB8jf94TtXbfSWYLD C13s5xtZzeewlHa7W3yJFXWKjt249NNM/KA4sJAeAtTtD7NSS8WW7/QibggsxPmQPmXv57 kIpwkiBnAVhPYe7IJTsO0FDznWDd1OOZQ+ajzSt8gBCHN5VLirML+17ejHusgHEHiODI3P sowQUsYKymAcFCeDCxmBQuD442a5qF7NQjkvWjfw5+Z5Fyp78ICYTNDgXKjRt4PEzAj9Pi T0kE/rk0Y2LRUf0Q83KMNEx8HxkxSSktz3xtUz+H1P1z5+sFIBaM46cwSP/2PA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1752391653; a=rsa-sha256; cv=none; b=jNdJeF3Q6D1/45VU9yekL4uIbrs4twWz0oK49yNr8RMHBL0Cxpm5onXQxPbwyhl8MSTc+5 gk7K2MpYBYJYCpki3L4wGexnQv/7SoBSoCXhjenA1uqZFt9SUAfoIj812v1CpKttUPyugY vweMfj4OVTJf2OX0docqYoEZcq7AhUGap/JVDR9JG5dursgOOzvYuP/D0FGP9tyjtU0SeC wO/aeab/QZR7yDpedi6xo2RBmnppRoOuVtWOzhMV0m9a9Qnm0+AAP0k/IqneC63urLOg63 ioaatlFkhide2w6wwnMb0GBwiVZeVMitjaoBYIy50IJWoYeq5dxxPBmO98t9DQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bfxqS6HYwzyfm; Sun, 13 Jul 2025 07:27:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 56D7RW9A094700; Sun, 13 Jul 2025 07:27:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56D7RW9M094697; Sun, 13 Jul 2025 07:27:32 GMT (envelope-from git) Date: Sun, 13 Jul 2025 07:27:32 GMT Message-Id: <202507130727.56D7RW9M094697@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Olivier Certner Subject: git: 986edb19a49c - main - LinuxKPI: Have kvzalloc() rely on kvmalloc(), not kmalloc() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: olce X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 986edb19a49c7d7d3050c759d9b0826283492ebf Auto-Submitted: auto-generated The branch main has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=986edb19a49c7d7d3050c759d9b0826283492ebf commit 986edb19a49c7d7d3050c759d9b0826283492ebf Author: Olivier Certner AuthorDate: 2025-07-07 13:28:21 +0000 Commit: Olivier Certner CommitDate: 2025-07-13 06:46:49 +0000 LinuxKPI: Have kvzalloc() rely on kvmalloc(), not kmalloc() Since commit 19df0c5abcb9d4e9 ("LinuxKPI: make __kmalloc() play by the rules"), kmalloc() systematically allocates contiguous physical memory, as it should. However, kvzalloc() was left defined in terms of kmalloc(), which makes it allocate contiguous physical memory too. This is a too stringent restriction, as kvzalloc() is supposed to be a simple page-zeroing wrapper around kvmalloc(). According to Linux's documentation ("memory-allocation.rst"), kvmalloc() first tries to allocate contiguous memory, falling back to non-contiguous one if that fails. Thus, callers are already supposed to deal with the possibility of non-contiguous memory being returned. Reviewed by: bz Fixes: 19df0c5abcb9 ("LinuxKPI: make __kmalloc() play by the rules") MFC after: 10 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D51247 --- sys/compat/linuxkpi/common/include/linux/slab.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/compat/linuxkpi/common/include/linux/slab.h b/sys/compat/linuxkpi/common/include/linux/slab.h index f3a840d9bf4b..efa5c8cb67b3 100644 --- a/sys/compat/linuxkpi/common/include/linux/slab.h +++ b/sys/compat/linuxkpi/common/include/linux/slab.h @@ -45,7 +45,7 @@ MALLOC_DECLARE(M_KMALLOC); -#define kvzalloc(size, flags) kmalloc(size, (flags) | __GFP_ZERO) +#define kvzalloc(size, flags) kvmalloc(size, (flags) | __GFP_ZERO) #define kvcalloc(n, size, flags) kvmalloc_array(n, size, (flags) | __GFP_ZERO) #define kzalloc(size, flags) kmalloc(size, (flags) | __GFP_ZERO) #define kzalloc_node(size, flags, node) kmalloc_node(size, (flags) | __GFP_ZERO, node)