]> www.infradead.org Git - users/dwmw2/linux.git/commit
mm: Implement for_each_valid_pfn() for CONFIG_SPARSEMEM
authorDavid Woodhouse <dwmw@amazon.co.uk>
Wed, 2 Apr 2025 17:58:36 +0000 (18:58 +0100)
committerDavid Woodhouse <dwmw@amazon.co.uk>
Fri, 4 Apr 2025 13:45:53 +0000 (14:45 +0100)
commit7e6a00cb1d7eba2dc2bf726da2c2358a323b4ad4
treec4a2154c38ef79f8cf54a65b92ce04e2df2d992e
parent8083d53bffaaf8527b0014a7869bcd246b3717ad
mm: Implement for_each_valid_pfn() for CONFIG_SPARSEMEM

Introduce a pfn_first_valid() helper which takes a pointer to the PFN and
updates it to point to the first valid PFN starting from that point, and
returns true if a valid PFN was found.

This largely mirrors pfn_valid(), calling into a pfn_section_first_valid()
helper which is trivial for the !CONFIG_SPARSEMEM_VMEMMAP case, and in
the VMEMMAP case will skip to the next subsection as needed.

Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
Reviewed-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
include/linux/mmzone.h