On Mon, 2007-02-19 at 22:24 +0100, Gilles Chanteperdrix wrote:
> Jan Kiszka wrote:
>  > May this hunk explain the behaviour?
>  > 
>  > 
> http://www.rts.uni-hannover.de/xenomai/lxr/source/ksrc/arch/i386/patches/adeos-ipipe-2.6.20-i386-1.7-02.patch?a=i386;v=SVN-2.3.x#7755
>  > 
>  > munlockall is realised via mlockall, so OR'ing here would never take
>  > away any flag.
> 
> My intent was to avoid that the VM_PINNED flag be cleared by mlockall.
> So, I guess the correct pattern is:
> 
> current->mm->def_flags = current->mm->def_flags & ~VM_LOCKED | def_flags;
> 

In such a case, I would suggest the following, so that we don't copy
unwanted regular flags unexpectedly:

--- a/mm/mlock.c
+++ b/mm/mlock.c
@@ -162,10 +162,10 @@ asmlinkage long sys_munlock(unsigned long start, size_t 
len)
 static int do_mlockall(int flags)
 {
        struct vm_area_struct * vma, * prev = NULL;
-       unsigned int def_flags = 0;
+       unsigned int def_flags = current->mm->def_flags & VM_PINNED;
 
        if (flags & MCL_FUTURE)
-               def_flags = VM_LOCKED;
+               def_flags |= VM_LOCKED;
        current->mm->def_flags = def_flags;
        if (flags == MCL_FUTURE)
                goto out;

-- 
Philippe.



_______________________________________________
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core

Reply via email to