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

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

 



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.

>  	if (flags == MCL_FUTURE)
>  		goto out;
>  

-- 
 Kirill A. Shutemov

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>



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