On Tue, Aug 05, 2025 at 04:00:53PM +0300, Linus Torvalds wrote: > On Tue, 5 Aug 2025 at 10:47, David Hildenbrand <david@xxxxxxxxxx> wrote: > > > > The concern is rather false positives, meaning, you want consecutive > > PFNs (just like within a folio), but -- because the stars aligned -- > > you get consecutive "struct page" that do not translate to consecutive PFNs. > > So I don't think that can happen with a valid 'struct page', because > if the 'struct page's are in different sections, they will have been > allocated separately too. This is certainly true for the CONFIG_SPARSEMEM_VMEMMAP case, but in the other cases I thought we end up with normal allocations for struct page? This is what David was talking about. So then we are afraid of this: a = kvmalloc_array(nelms_a); b = kvmalloc_array(nelms_b); assert(a + nelms_a != b) I thought this was possible with our allocator, especially vmemmap? David, there is another alternative to prevent this, simple though a bit wasteful, just allocate a bit bigger to ensure the allocation doesn't end on an exact PAGE_SIZE boundary? Jason