Re: [PATCH v2] fix mlocked page counter mistmatch

From: MinChan Kim
Date: Tue Feb 03 2009 - 23:58:19 EST


On Wed, Feb 04, 2009 at 11:51:43AM +0900, KOSAKI Motohiro wrote:
> > > Could you please teach me why this issue doesn't happend on munlockall()?
> > > your scenario seems to don't depend on exit_mmap().
> >
> >
> > Good question.
> > It's a different issue.
> > It is related to mmap_sem locking issue.
> >
> > Actually, I am about to make a patch.
> > But, I can't understand that Why try_do_mlock_page should downgrade mm_sem ?
> > Is it necessary ?
> >
> > In munlockall path, mmap_sem already is holding in write-mode of mmap_sem.
> > so, try_to_mlock_page always fail to downgrade mmap_sem.
> > It's why it looks like working well about mlocked counter.
>
> lastest linus tree don't have downgrade mmap_sem.
> (recently it was removed)

Thnaks for information.

what is 'latest linus tree' ?
You mean '29-rc3-git5'?


With '29-rc3-git5', I found,

static int try_to_mlock_page(struct page *page, struct vm_area_struct *vma)
{
int mlocked = 0;

if (down_read_trylock(&vma->vm_mm->mmap_sem)) {
if (vma->vm_flags & VM_LOCKED) {
mlock_vma_page(page);
mlocked++; /* really mlocked the page */
}
up_read(&vma->vm_mm->mmap_sem);
}
return mlocked;
}

It still try to downgrade mmap_sem.
Do I miss something ?

>
> please see it.
>

--
Kinds Regards
MinChan Kim

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/