Re: [PATCH v2 7/8] mm: refactor __mmap_region()

From: Vlastimil Babka
Date: Fri Oct 25 2024 - 06:23:56 EST


On 10/25/24 12:19, Lorenzo Stoakes wrote:
> On Fri, Oct 25, 2024 at 10:35:20AM +0200, Vlastimil Babka wrote:
>> >
>> > /* Lock the VMA since it is modified after insertion into VMA tree */
>> > vma_start_write(vma);
>> > - vma_iter_store(&vmi, vma);
>> > - mm->map_count++;
>> > + vma_iter_store(vmi, vma);
>> > + map->mm->map_count++;
>> > vma_link_file(vma);
>> >
>> > /*
>> > * vma_merge_new_range() calls khugepaged_enter_vma() too, the below
>> > * call covers the non-merge case.
>> > */
>> > - khugepaged_enter_vma(vma, vma->vm_flags);
>> > + khugepaged_enter_vma(vma, map->flags);
>> >
>> > file_expanded:
>> > - file = vma->vm_file;
>> > ksm_add_vma(vma);
>>
>> I'm wondering if this could go to the "non file expanded" region above. If
>> we expanded a vma, it was either in ksm and stays in ksm, or it was not
>> eligible and that couldn't have changed by expanding?
>
> We could change this, but the next commit removes the need for this :)

Yeah, no need to change here then.