From: Andrew Morton <akpm@linux-foundation.org>
To: "Mike Rapoport (Microsoft)" <rppt@kernel.org>
Cc: Song Liu <song@kernel.org>, Yu Kuai <yukuai@fnnas.com>,
Li Nan <linan122@huawei.com>, Xiao Ni <xiao@kernel.org>,
David Laight <david.laight.linux@gmail.com>,
linux-kernel@vger.kernel.org, linux-mm@kvack.org,
linux-raid@vger.kernel.org, Christoph Hellwig <hch@lst.de>
Subject: Re: [PATCH v2 2/2] lib/raid6: use kvmalloc() in raid6_select_algo()
Date: Tue, 26 May 2026 10:34:24 -0700 [thread overview]
Message-ID: <20260526103424.0d884374dee8cbc4f9f17c3a@linux-foundation.org> (raw)
In-Reply-To: <20260526-lib-v2-2-ca3f0fc24b14@kernel.org>
On Tue, 26 May 2026 15:50:39 +0300 "Mike Rapoport (Microsoft)" <rppt@kernel.org> wrote:
> raid6_select_algo() allocates an order 3 (8 pages) buffer that is used
> as a scratch area for selection of the best algorithm.
>
> This buffer does not need to be physically contiguous and can be
> allocated with kvmalloc().
>
> Replace __get_free_pages() call with kvmalloc().
This one needed some massaging due to hch's "cleanup the RAID6 P/Q
library" in mm-nonmm-unstable
(https://lore.kernel.org/20260518051804.462141-1-hch@lst.de)
From: "Mike Rapoport (Microsoft)" <rppt@kernel.org>
Subject: lib/raid6: use kvmalloc() in raid6_select_algo()
Date: Tue, 26 May 2026 15:50:39 +0300
raid6_select_algo() allocates an order 3 (8 pages) buffer that is used
as a scratch area for selection of the best algorithm.
This buffer does not need to be physically contiguous and can be
allocated with kvmalloc().
Replace __get_free_pages() call with kvmalloc().
Link: https://lore.kernel.org/all/635405e4-9423-4a25-a6e7-e03c8ea0bcbe@redhat.com
Link: https://lore.kernel.org/20260526-lib-v2-2-ca3f0fc24b14@kernel.org
Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
lib/raid/raid6/algos.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
--- a/lib/raid/raid6/algos.c~lib-raid6-use-kvmalloc-in-raid6_select_algo
+++ a/lib/raid/raid6/algos.c
@@ -7,6 +7,7 @@
#include <linux/module.h>
#include <linux/gfp.h>
+#include <linux/slab.h>
#include <linux/raid/pq.h>
#include <linux/static_call.h>
#include <kunit/visibility.h>
@@ -153,7 +154,6 @@ EXPORT_SYMBOL_GPL(raid6_recov_datap);
#define RAID6_TIME_JIFFIES_LG2 4
#define RAID6_TEST_DISKS 8
-#define RAID6_TEST_DISKS_ORDER 3
static int raid6_choose_gen(void *(*const dptrs)[RAID6_TEST_DISKS],
const int disks)
@@ -247,7 +247,7 @@ static int __init raid6_select_algo(void
}
/* prepare the buffer and fill it circularly with gfmul table */
- disk_ptr = (char *)__get_free_pages(GFP_KERNEL, RAID6_TEST_DISKS_ORDER);
+ disk_ptr = kvmalloc(PAGE_SIZE * RAID6_TEST_DISKS, GFP_KERNEL);
if (!disk_ptr) {
pr_err("raid6: Yikes! No memory available.\n");
return -ENOMEM;
@@ -269,7 +269,7 @@ static int __init raid6_select_algo(void
/* select raid gen_syndrome function */
error = raid6_choose_gen(&dptrs, disks);
- free_pages((unsigned long)disk_ptr, RAID6_TEST_DISKS_ORDER);
+ kvfree(disk_ptr);
return error;
}
_
next prev parent reply other threads:[~2026-05-26 17:34 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-26 12:50 [PATCH v2 0/2] lib/raid: replace __get_free_pages() call with kvmalloc() Mike Rapoport (Microsoft)
2026-05-26 12:50 ` [PATCH v2 1/2] lib/raid: use kvmalloc() in calibrate_xor_blocks() Mike Rapoport (Microsoft)
2026-05-27 7:32 ` Christoph Hellwig
2026-05-26 12:50 ` [PATCH v2 2/2] lib/raid6: use kvmalloc() in raid6_select_algo() Mike Rapoport (Microsoft)
2026-05-26 17:34 ` Andrew Morton [this message]
2026-05-27 6:38 ` Christoph Hellwig
2026-05-27 11:28 ` Mike Rapoport
2026-05-27 7:33 ` Christoph Hellwig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260526103424.0d884374dee8cbc4f9f17c3a@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=david.laight.linux@gmail.com \
--cc=hch@lst.de \
--cc=linan122@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-raid@vger.kernel.org \
--cc=rppt@kernel.org \
--cc=song@kernel.org \
--cc=xiao@kernel.org \
--cc=yukuai@fnnas.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®