Re: [PATCH 1/2] mm/mlock: not handle NULL vma specially

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, 8 May 2022 05:56:15 +0800 Wei Yang <richard.weiyang@xxxxxxxxx> wrote:

> > > -     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.
> >
> 
> I took a look at mm-unstabe branch with last commit
> 
>   2b58b3f33ba2 mm/shmem: convert shmem_swapin_page() to shmem_swapin_folio()
> 

It isn't early to mid next week yet ;)

> Function count_mm_mlocked_page_nr() looks not changed.
> 
> Do I need to rebase on top of it?

static unsigned long count_mm_mlocked_page_nr(struct mm_struct *mm,
		unsigned long start, size_t len)
{
	struct vm_area_struct *vma;
	unsigned long count = 0;
	unsigned long end;
	VMA_ITERATOR(vmi, mm, start);

	if (mm == NULL)
		mm = current->mm;

	/* Don't overflow past ULONG_MAX */
	if (unlikely(ULONG_MAX - len < start))
		end = ULONG_MAX;
	else
		end = start + len;
	for_each_vma_range(vmi, vma, end) {
		if (vma->vm_flags & VM_LOCKED) {
			if (start > vma->vm_start)
				count -= (start - vma->vm_start);
			if (end < vma->vm_end) {
				count += end - vma->vm_start;
				break;
			}
			count += vma->vm_end - vma->vm_start;
		}
	}

	return count >> PAGE_SHIFT;
}





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux