Re: [v2 PATCH] lib/raid6: Replace custom zero page with ZERO_PAGE

From: Klara Modin
Date: Fri Jun 20 2025 - 12:50:10 EST


Hi,

On 2025-03-17 17:02:28 +0800, Herbert Xu wrote:
> Use the system-wide zero page instead of a custom zero page.
>
> Signed-off-by: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
>

...
> diff --git a/include/linux/raid/pq.h b/include/linux/raid/pq.h
> index 98030accf641..428ca76e4deb 100644
> --- a/include/linux/raid/pq.h
> +++ b/include/linux/raid/pq.h
> @@ -11,8 +11,13 @@
> #ifdef __KERNEL__
>
> #include <linux/blkdev.h>
> +#include <linux/mm.h>
>
> -extern const char raid6_empty_zero_page[PAGE_SIZE];
> +/* This should be const but the raid6 code is too convoluted for that. */
> +static inline void *raid6_get_zero_page(void)
> +{
> + return page_address(ZERO_PAGE(0));
> +}
>
> #else /* ! __KERNEL__ */
> /* Used for testing in user space */
> @@ -186,6 +191,11 @@ static inline uint32_t raid6_jiffies(void)
> return tv.tv_sec*1000 + tv.tv_usec/1000;
> }
>
> +static inline void *raid6_get_zero_page(void)
> +{
> + return raid6_empty_zero_page;
> +}
> +
> #endif /* ! __KERNEL__ */
>
> #endif /* LINUX_RAID_RAID6_H */
...

Note that an RISC-V vector syndrome implementation was added in commit
6093faaf9593 ("raid6: Add RISC-V SIMD syndrome and recovery calculations")
which this patch does not change.

Regards,
Klara Modin

Link: https://lore.kernel.org/r/20250305083707.74218-1-zhangchunyan@xxxxxxxxxxx