Re: [PATCH v7] mm: assert exclusive nid/zonenum bits at the page/folio access sites
From: David Hildenbrand (Arm)
Date: Fri Jun 26 2026 - 05:14:36 EST
>>
>> static inline enum zone_type folio_zonenum(const struct folio *folio)
>> {
>> +#if ZONES_WIDTH != 0
>> + ASSERT_EXCLUSIVE_BITS(folio->flags, ZONES_MASK << ZONES_PGSHIFT);
>> +#endif
>> return memdesc_zonenum(folio->flags);
>> }
>>
>
> Better to factor out a common macro alongside a comment for these two '#if'?
Yes.
And while looking at it, doesn't memdesc_section have similar problems? And
there are other callers of memdesc_zonenum we wouldn't handle. So the
macro approach is only partially helpful I thing.
Maybe we should just pass by reference and fixup all callers? Ends up the cleanest.
Untested: