[PATCH v4 7/7] mm/mm_init: Use for_each_valid_pfn() in init_unavailable_range()
David Woodhouse
dwmw2 at infradead.org
Fri Apr 25 16:04:46 PDT 2025
On Fri, 2025-04-25 at 22:12 +0200, David Hildenbrand wrote:
>
> In any case, trying to figure out why Lorenzo ran into an issue ... if
> it's nit because of the pageblock, maybe something in for_each_valid_pfn
> with sparsemem is still shaky.
Yep, I think this was it:
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -2190,10 +2190,10 @@ static inline unsigned long next_valid_pfn(unsigned long pfn, unsigned long end_
/*
* Either every PFN within the section (or subsection for VMEMMAP) is
* valid, or none of them are. So there's no point repeating the check
- * for every PFN; only call first_valid_pfn() the first time, and when
- * crossing a (sub)section boundary (i.e. !(pfn & ~PFN_VALID_MASK)).
+ * for every PFN; only call first_valid_pfn() again when crossing a
+ * (sub)section boundary (i.e. !(pfn & ~PAGE_{SUB,}SECTION_MASK)).
*/
- if (pfn & (IS_ENABLED(CONFIG_SPARSEMEM_VMEMMAP) ?
+ if (pfn & ~(IS_ENABLED(CONFIG_SPARSEMEM_VMEMMAP) ?
PAGE_SUBSECTION_MASK : PAGE_SECTION_MASK))
return pfn;
I've pushed the fixed version out to
https://git.infradead.org/users/dwmw2/linux.git/shortlog/refs/heads/for_each_valid_pfn
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5069 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20250426/0ef59c7a/attachment.p7s>
More information about the linux-arm-kernel
mailing list