From nobody Mon Jun 8 15:36:53 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4AD413B4EA0; Thu, 28 May 2026 09:53:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779961994; cv=none; b=M3dl/K3IQnQZ4kYKmS29CKS0+hwzrsscCTOI2toVAFOX5I1jBKWUTPk0qqqLxs46FuGNOLBO86avm9UFP9ixXBg75CaJJsBOFjW6xHKwWJKvvLXEvGrdbakXMa7wYYAuGbkDu0VeIWgCVqvZjd3LnhOAUj+oN8GKldOr9NjzNhI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779961994; c=relaxed/simple; bh=WvdyEqmecA0grKVohRIg0XDFkSrkSv+rOqxMzjkqAK8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=iumpdDbqR9fa6rtPAth+ZQX9kWUqIvjYXs9XZNtusVmsVtuYe+2YBDRpuGdoeZVZNS2Jz9imQTASDsHOrWHGkD4mxSVQeFraeuJDSLV0J3uu8EoHkTI3lBSYwSnKlHubO/SjPUaDTA4jQ01H0b4NoT/JXkJ6UIAfir0gsJLjFcc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=WB61z4ru; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="WB61z4ru" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9ACE01F00A3A; Thu, 28 May 2026 09:53:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1779961993; bh=OGdbcQNrXQCL8Ddddea0/7LpE/hNNIjnFgj+CnQ/xTk=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=WB61z4ruKXd3kXi1juwOnQTES0jP99vbhpjVKBseJzQqU1WvQmmXuMsPpFfXt7Q4+ P3kRes5EuGy9jA7anxILQUeKc5/PfdDeoQx2dq6AImVn/4x/shEwx1HK3kHFR2vhjr Vdef5wZzavi7Sa+MPNkPU/J3WHaL98aNiC6ztibn92IHxqb9RTrjkeJyICbIX4oqOf R19dn9KX2Ts4jN9QTCA2rAwnZsLEa8fh++SpO4zDDPdEjJF0kx3SVVRYD7GRy0Wpx6 oYnqJNf/i9/8cQWqr2JbcixE/o1a5vnALBxJMzgisHS+mOtLpK57/VvEkU9NkJiaxE LLRCCsjs8RFFQ== From: "Mike Rapoport (Microsoft)" Date: Thu, 28 May 2026 12:53:00 +0300 Subject: [PATCH v4 1/2] xor: use kmalloc() in calibrate_xor_blocks() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260528-lib-v4-1-4e3ad1277279@kernel.org> References: <20260528-lib-v4-0-4e3ad1277279@kernel.org> In-Reply-To: <20260528-lib-v4-0-4e3ad1277279@kernel.org> To: Andrew Morton Cc: Christoph Hellwig , David Laight , Li Nan , Mike Rapoport , Song Liu , Xiao Ni , Yu Kuai , linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-raid@vger.kernel.org X-Mailer: b4 0.15.2 The xor benchmark allocates 4 pages for a scratch buffer that is used purely as a CPU-only XOR working area. This buffer can be allocated with kmalloc() as there's nothing special about it to go directly to the page allocator. kmalloc() provides a better API than ancient __get_free_pages(). kmalloc() does not require ugly casts and kfree() does not need to know the size of the freed object. There is no performance difference because kmalloc() redirects allocations of such size to the page allocator. Replace __get_free_pages() call with kmalloc(). Link: https://lore.kernel.org/all/635405e4-9423-4a25-a6e7-e03c8ea0bcbe@redh= at.com Signed-off-by: Mike Rapoport (Microsoft) Reviewed-by: Christoph Hellwig Reviewed-by: Hannes Reinecke --- lib/raid/xor/xor-core.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/raid/xor/xor-core.c b/lib/raid/xor/xor-core.c index bd4e6e434418..50931fbf0324 100644 --- a/lib/raid/xor/xor-core.c +++ b/lib/raid/xor/xor-core.c @@ -8,6 +8,7 @@ =20 #include #include +#include #include #include #include @@ -114,7 +115,7 @@ static int __init calibrate_xor_blocks(void) if (forced_template) return 0; =20 - b1 =3D (void *) __get_free_pages(GFP_KERNEL, 2); + b1 =3D kmalloc(PAGE_SIZE * 4, GFP_KERNEL); if (!b1) { pr_warn("xor: Yikes! No memory available.\n"); return -ENOMEM; @@ -132,7 +133,7 @@ static int __init calibrate_xor_blocks(void) pr_info("xor: using function: %s (%d MB/sec)\n", fastest->name, fastest->speed); =20 - free_pages((unsigned long)b1, 2); + kfree(b1); return 0; } =20 --=20 2.53.0 From nobody Mon Jun 8 15:36:53 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A37373B6346; Thu, 28 May 2026 09:53:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779961997; cv=none; b=qnV8BNZ6RZdl0nzv6Hz41vBZ3NrUsYFU6TJ6PqHDeisJkuh2R3aHj9XnpkCSLdUD8rmJ0Zvjc0jUiyZ7O94H3t1/41cirbr2a09l3l3LozM75g44ApjLhZ/unafm8t70H9goesaUWxQAQXSwuiAvRNBbQEZ1UNMz+xPQajI0rd4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779961997; c=relaxed/simple; bh=DJA39YJldJC0EahsoGyUjOm+muY3fu6WBaRd4TOEwDA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=FAAENlmoUkmCiusNvaRDXvM0qenjc8CuBZ/oF/aOWXA4Ub8FF04sS8J7/5vVUXEbcGrunUpgVq0n336NyYdvIRRkSV2DxuraVdZnwzBbSNDav4j06YyNaN9XGbRV6UBLpZaIq4hcOB19jKwAcSQh5HHSTJ0Ek7+J+u9+6t/tFJw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=UFAb6hli; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="UFAb6hli" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9ACD41F00A3C; Thu, 28 May 2026 09:53:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1779961996; bh=nsDtOl3cQ8re9LG+iRAo65uWQwcKMxb80zOtaLHEWdM=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=UFAb6hliRTB3p+BbANMRHD8BOvyxRcxNLa02dbMyduid7xiapuqLcTzcMu+XIAgJ4 /alyAWeWIgmMLhjbMT7quBrjg6uMKDiXCs2a0ep3tAPT7IIsC5CtnpHyO8yWUx4gVk jK4PCHCm9tZ6XS970c9AEHUrSJFjbrkAb+wNHhrNvRfpvZOTj5eCV4H/WHuSzdsWsD 8WHvUr0q3HjZsj9/LaFfSGY+0pnucT58pHjCmwQlyGaBmIkRzNtZiIwlMBWwg1Ivj+ 5YnTG4uq+55/t6bz1O4JFHuAIFXvvmJochXb7E7Vpi5567mlcy98q8f0nVl7cztVPr m9gNygNDfkcSQ== From: "Mike Rapoport (Microsoft)" Date: Thu, 28 May 2026 12:53:01 +0300 Subject: [PATCH v4 2/2] raid6: use kmalloc() in raid6_select_algo() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260528-lib-v4-2-4e3ad1277279@kernel.org> References: <20260528-lib-v4-0-4e3ad1277279@kernel.org> In-Reply-To: <20260528-lib-v4-0-4e3ad1277279@kernel.org> To: Andrew Morton Cc: Christoph Hellwig , David Laight , Li Nan , Mike Rapoport , Song Liu , Xiao Ni , Yu Kuai , linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-raid@vger.kernel.org, Christoph Hellwig X-Mailer: b4 0.15.2 raid6_select_algo() allocates 8 pages for buffer that is used as a scratch area for selection of the best algorithm. This buffer can be allocated with kmalloc() as there's nothing special about it to go directly to the page allocator. kmalloc() provides a better API than ancient __get_free_pages(). kmalloc() does not require ugly casts and kfree() does not need to know the size of the freed object. There is no performance difference because kmalloc() redirects allocations of such size to the page allocator. Replace __get_free_pages() call with kmalloc(). Link: https://lore.kernel.org/all/635405e4-9423-4a25-a6e7-e03c8ea0bcbe@redh= at.com Signed-off-by: Mike Rapoport (Microsoft) Reviewed-by: Christoph Hellwig --- lib/raid6/algos.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/raid6/algos.c b/lib/raid6/algos.c index 799e0e5eac26..89e627c62e30 100644 --- a/lib/raid6/algos.c +++ b/lib/raid6/algos.c @@ -12,6 +12,7 @@ */ =20 #include +#include #ifndef __KERNEL__ #include #include @@ -129,7 +130,6 @@ const struct raid6_recov_calls *const raid6_recov_algos= [] =3D { #endif =20 #define RAID6_TEST_DISKS 8 -#define RAID6_TEST_DISKS_ORDER 3 =20 static inline const struct raid6_recov_calls *raid6_choose_recov(void) { @@ -250,7 +250,7 @@ int __init raid6_select_algo(void) int i, cycle; =20 /* prepare the buffer and fill it circularly with gfmul table */ - disk_ptr =3D (char *)__get_free_pages(GFP_KERNEL, RAID6_TEST_DISKS_ORDER); + disk_ptr =3D kmalloc(PAGE_SIZE * RAID6_TEST_DISKS, GFP_KERNEL); if (!disk_ptr) { pr_err("raid6: Yikes! No memory available.\n"); return -ENOMEM; @@ -275,7 +275,7 @@ int __init raid6_select_algo(void) /* select raid recover functions */ rec_best =3D raid6_choose_recov(); =20 - free_pages((unsigned long)disk_ptr, RAID6_TEST_DISKS_ORDER); + kfree(disk_ptr); =20 return gen_best && rec_best ? 0 : -EINVAL; } --=20 2.53.0