On Mon, Dec 16, 2019 at 5:09 AM Zhengyuan Liu <liuzhengyuan@xxxxxxxxxx> wrote: > [...] > --- > include/linux/raid/pq.h | 17 +++++++--- > lib/raid6/algos.c | 71 +++++++++++++++++++++++++++-------------- > 2 files changed, 59 insertions(+), 29 deletions(-) > > diff --git a/include/linux/raid/pq.h b/include/linux/raid/pq.h > index e0ddb47f4402..6b68b9590a6b 100644 > --- a/include/linux/raid/pq.h > +++ b/include/linux/raid/pq.h > @@ -8,6 +8,8 @@ > #ifndef LINUX_RAID_RAID6_H > #define LINUX_RAID_RAID6_H > > +#define RAID6_DISKS 8 Maybe rename as RAID6_TEST_DISKS. [...] > +#endif > extern const char raid6_empty_zero_page[PAGE_SIZE]; > > #define __init > @@ -168,11 +174,12 @@ void raid6_dual_recov(int disks, size_t bytes, int faila, int failb, > # define pr_err(format, ...) fprintf(stderr, format, ## __VA_ARGS__) > # define pr_info(format, ...) fprintf(stdout, format, ## __VA_ARGS__) > # define GFP_KERNEL 0 > -# define __get_free_pages(x, y) ((unsigned long)mmap(NULL, PAGE_SIZE << (y), \ > - PROT_READ|PROT_WRITE, \ > - MAP_PRIVATE|MAP_ANONYMOUS,\ > - 0, 0)) > -# define free_pages(x, y) munmap((void *)(x), PAGE_SIZE << (y)) > +# define kmalloc(x, y) ((unsigned long)mmap(NULL, (x), PROT_READ|PROT_WRITE, \ > + MAP_PRIVATE|MAP_ANONYMOUS, \ > + 0, 0)) > +# define kfree(x) munmap((void *)(x), (RAID6_DISKS - 2) * PAGE_SIZE \ > + <= 65536 ? 2 * PAGE_SIZE : \ > + (RAID6_DISKS - 2) * PAGE_SIZE) Why do we change __get_free_pages to kmalloc? Thanks, Song [...]