From nobody Mon Jul 28 13:31:48 2025 X-Original-To: dev-commits-src-all@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 4brKBt3vWDz6354h; Mon, 28 Jul 2025 13:31:50 +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 4brKBr4bz7z3vbY; Mon, 28 Jul 2025 13:31:48 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753709508; 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=eylbEbibNj3kW0gbdm4uxcdzgSQredJPEOqSllJdyA8=; b=S6jgzQKKNCfSnBZ178EYyoTk4Oegz+7gV63VxuLrGTmEOxlPNoDY6nr/X+TVTn7Nas8jIH 3uF5dlfsdw0jJyvaRcfc+UVSI3+EpfzmwhMc7N/+cDFpygPQcCxZE3CxigZpGtxB0C5Ifw rERA3Q5/Cfiw81uFdGS3rDYkU1J5XRCgatqCzymYM4crhSAl11go2a1U3ch3WRSPeH6Wbu qGAMKV7rkE1UxzOV8Vw2rvHpp80Vp62P/Q1s+e/uTmKoWnZ09oNoL+DMiJnSOAF6DzKx3H CPnqwIVS0iGfOkdc/EBd8ciOmapSUaQaewj5mlnqBt0OzTjvIHqUw4d1utHE6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753709508; 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=eylbEbibNj3kW0gbdm4uxcdzgSQredJPEOqSllJdyA8=; b=guJE6lr3Rkcz6YbVphiTqJyLLPsdkb4yRFnYuoiWuxabikl3VW6SSbY+XJZzxOIksRAx+f 7ubTxWP2Ra2B/PWthSRVS32yxn9YaNI8hL6qj25s4EIK9+/A++21qLyRL7dOKNFepcWVfG Gl2siuprvtOChhpsjUQW4sYtTCekfG2lDLyEH6f2qpF3krzNsacwbPqg8DxSzG9KSsXh7Z HRrY2iU/ZlJUd7EpA1ggunQ9MaZ3JxhxRec0ZjWaSfaAr4s3B5y2L/c5UobgGTaxbz4Q/b HyJfbdIxz20XfxzVZdTOZJtvjdB3IWmYozlfEtEXfURPoq/bU5bgy53h8Si6eA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753709508; a=rsa-sha256; cv=none; b=KOpOEw/bLIagh/Af5xxAAA83spQIBpkCgaUlQ4nvdPY5NGMBd7xPRcNIvYCmloRp+KTdHA o+mH86AJaKtkML+feFJEgi6Tze4Bqn/7Gdygyat525S2ieu99NqUeB15zHl4Bpn0bh1OKz rfAOxniapAtK+VBnF2ZeQUvjFZGY3JkeA125672BxHHagDHh4BvEjXb8VNH/bnCgE6abeZ IYCSs1BVXhv9Y+xTmzhUugYxlQLDJaLEd/SVanKzWku5TkRforzqh6qu3lbZK6dnWxVuE0 6QXbY8AIzbWe7ZWUSEYHrQmN/IO1y76dOE6Bb0ERkR9F1O0tzYq/eL4MK49nPw== 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 4brKBr3l9QznsF; Mon, 28 Jul 2025 13:31:48 +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 56SDVmbG082435; Mon, 28 Jul 2025 13:31:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56SDVmBA082432; Mon, 28 Jul 2025 13:31:48 GMT (envelope-from git) Date: Mon, 28 Jul 2025 13:31:48 GMT Message-Id: <202507281331.56SDVmBA082432@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Olivier Certner Subject: git: 8e1b8ae7298f - stable/14 - LinuxKPI: Have kvzalloc() rely on kvmalloc(), not kmalloc() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@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/stable/14 X-Git-Reftype: branch X-Git-Commit: 8e1b8ae7298fc8ec91f6d7dc040341343c894e57 Auto-Submitted: auto-generated The branch stable/14 has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=8e1b8ae7298fc8ec91f6d7dc040341343c894e57 commit 8e1b8ae7298fc8ec91f6d7dc040341343c894e57 Author: Olivier Certner AuthorDate: 2025-07-07 13:28:21 +0000 Commit: Olivier Certner CommitDate: 2025-07-28 13:28:50 +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 (cherry picked from commit 986edb19a49c7d7d3050c759d9b0826283492ebf) Forgotten on commit to main/-CURRENT: PR: 277476 --- 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)