[RFC PATCH] mm: remove zap_page_range and change callers to use zap_vma_page_range

Alistair Popple apopple at nvidia.com
Thu Jan 5 12:14:36 AEDT 2023


Mike Kravetz <mike.kravetz at oracle.com> writes:

> On 12/19/22 13:06, Michal Hocko wrote:
>> On Fri 16-12-22 11:20:12, Mike Kravetz wrote:
>> > zap_page_range was originally designed to unmap pages within an address
>> > range that could span multiple vmas.  While working on [1], it was
>> > discovered that all callers of zap_page_range pass a range entirely within
>> > a single vma.  In addition, the mmu notification call within zap_page
>> > range does not correctly handle ranges that span multiple vmas as calls
>> > should be vma specific.
>> 
>> Could you spend a sentence or two explaining what is wrong here?
>
> Hmmmm?  My assumption was that the range passed to mmu_notifier_range_init()
> was supposed to be within the specified vma.  When looking into the notifier
> routines, I could not find any documentation about the usage of the vma within
> the mmu_notifier_range structure.  It was introduced with commit bf198b2b34bf
> "mm/mmu_notifier: pass down vma and reasons why mmu notifier is happening".
> However, I do not see this being used today.
>
> Of course, I could be missing something, so adding Jérôme.

The only use for mmu_notifier_range->vma I can find is in
mmu_notifier_range_update_to_read_only() which was introduced in
c6d23413f81b ("mm/mmu_notifier: mmu_notifier_range_update_to_read_only()
helper"). However there are no users of that symbol so I think we can
remove it along with the mmu_notifier_range->vma field.

I will put togeather a patch to do that.

>> 
>> > Instead of fixing zap_page_range, change all callers to use the new
>> > routine zap_vma_page_range.  zap_vma_page_range is just a wrapper around
>> > zap_page_range_single passing in NULL zap details.  The name is also
>> > more in line with other exported routines that operate within a vma.
>> > We can then remove zap_page_range.
>> 
>> I would stick with zap_page_range_single rather than adding a new
>> wrapper but nothing really critical.
>
> I am fine with doing that as well.  My only reason for the wrapper is that all 
> callers outside mm/memory.c would pass in NULL zap details.
>
>> 
>> > Also, change madvise_dontneed_single_vma to use this new routine.
>> > 
>> > [1] https://lore.kernel.org/linux-mm/20221114235507.294320-2-mike.kravetz@oracle.com/
>> > Suggested-by: Peter Xu <peterx at redhat.com>
>> > Signed-off-by: Mike Kravetz <mike.kravetz at oracle.com>
>> 
>> Other than that LGTM
>> Acked-by: Michal Hocko <mhocko at suse.com>
>> 
>> Thanks!
>
> Thanks for taking a look.



More information about the Linuxppc-dev mailing list