Re: [PATCH resend v2] /dev/zero: try to align PMD_SIZE for private mapping

From: Matthew Wilcox
Date: Wed Jul 30 2025 - 08:49:55 EST


On Wed, Jul 30, 2025 at 05:19:05PM +0800, Zhang Qilong wrote:
> + if (IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE))
> + return thp_get_unmapped_area(file, addr, len, pgoff, flags);
> +
> return mm_get_unmapped_area(current->mm, file, addr, len, pgoff, flags);

I'm sure the build bots will give us a compiler error.
If CONFIG_TRANSPARENT_HUGEPAGE is not enabled, we get:
include/linux/huge_mm.h:#define thp_get_unmapped_area NULL

and we chose that so that various filesystems can unconditionally set
their .get_unmapped_area method to it.

Which means the cpp will turn this into:

if (0)
return NULL(file, addr, len, pgoff, flags);

and the compiler will say:

error: implicit declaration of function ‘NULL’ [-Wimplicit-function-declaration]