Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1189987 > unrolled thread

Re: [PATCH V4 1/6] mm: mlock: Refactor mlock, munlock, and munlockall code

Started byEric B Munson <emunson@akamai.com>
First post2015-07-22 16:10 +0200
Last post2015-07-22 16:10 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH V4 1/6] mm: mlock: Refactor mlock, munlock, and  munlockall code Eric B Munson <emunson@akamai.com> - 2015-07-22 16:10 +0200

#1189987 — Re: [PATCH V4 1/6] mm: mlock: Refactor mlock, munlock, and munlockall code

FromEric B Munson <emunson@akamai.com>
Date2015-07-22 16:10 +0200
SubjectRe: [PATCH V4 1/6] mm: mlock: Refactor mlock, munlock, and munlockall code
Message-ID<pP2SD-Cp-67@gated-at.bofh.it>

[Multipart message — attachments visible in raw view] — view raw

On Wed, 22 Jul 2015, Kirill A. Shutemov wrote:

> On Tue, Jul 21, 2015 at 03:59:36PM -0400, Eric B Munson wrote:
> > @@ -648,20 +656,23 @@ SYSCALL_DEFINE2(munlock, unsigned long, start, size_t, len)
> >  	start &= PAGE_MASK;
> >  
> >  	down_write(&current->mm->mmap_sem);
> > -	ret = do_mlock(start, len, 0);
> > +	ret = apply_vma_flags(start, len, flags, false);
> >  	up_write(&current->mm->mmap_sem);
> >  
> >  	return ret;
> >  }
> >  
> > +SYSCALL_DEFINE2(munlock, unsigned long, start, size_t, len)
> > +{
> > +	return do_munlock(start, len, VM_LOCKED);
> > +}
> > +
> >  static int do_mlockall(int flags)
> >  {
> >  	struct vm_area_struct * vma, * prev = NULL;
> >  
> >  	if (flags & MCL_FUTURE)
> >  		current->mm->def_flags |= VM_LOCKED;
> > -	else
> > -		current->mm->def_flags &= ~VM_LOCKED;
> 
> I think this is wrong.
> 
> With current code mlockall(MCL_CURRENT) after mlockall(MCL_FUTURE |
> MCL_CURRENT) would undo future mlocking, without unlocking currently
> mlocked memory.
> 
> The change will break the use-case.

It is wrong and I have addressed it in this case as well as with the
MCL_ONFAULT flag introduced in patch 4.  I will also add to the mlockall
man page to specify this behavior.

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web