Re: [PATCHv2 1/2] mm/memory: Do not populate page table entries beyond i_size

From: Kirill A. Shutemov
Date: Fri Oct 24 2025 - 15:33:17 EST




On Fri, Oct 24, 2025, at 16:42, David Hildenbrand wrote:
> On 23.10.25 11:32, Kiryl Shutsemau wrote:
>> addr0 = addr - start * PAGE_SIZE;
>> if (folio_within_vma(folio, vmf->vma) &&
>> - (addr0 & PMD_MASK) == ((addr0 + folio_size(folio) - 1) & PMD_MASK)) {
>> + (addr0 & PMD_MASK) == ((addr0 + folio_size(folio) - 1) & PMD_MASK) &&
>
> Isn't this just testing whether addr0 is aligned to folio_size(folio)?
> (given that we don't support folios > PMD_SIZE), like
>
> IS_ALIGNED(addr0, folio_size(folio))

Actually, no. VMA can be not aligned to folio_size().

--
Kiryl Shutsemau / Kirill A. Shutemov