On Wed, 4 May 2022 00:39:57 +0000 Wei Yang <richard.weiyang@xxxxxxxxx> wrote: > If we can't find a proper vma, the loop would terminate as expected. > > It's not necessary to handle it specially. > > ... > > --- a/mm/mlock.c > +++ b/mm/mlock.c > @@ -504,11 +504,7 @@ static unsigned long count_mm_mlocked_page_nr(struct mm_struct *mm, > if (mm == NULL) > mm = current->mm; > > - vma = find_vma(mm, start); > - if (vma == NULL) > - return 0; > - > - for (; vma ; vma = vma->vm_next) { > + for (vma = find_vma(mm, start); vma ; vma = vma->vm_next) { > if (start >= vma->vm_end) > continue; > if (start + len <= vma->vm_start) The mapletree patches mangle this code a lot. Please take a look at linux-next or the mm-unstabe branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm early to mid next week, see if you see anything which should be addressed.