[lkml]   [2011]   [Jan]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH] mlock: revert the optimization for dirtying pages and triggering writeback.
On Sat, Jan 29, 2011 at 11:15 PM, Tao Ma <> wrote:
>        buf = mmap(NULL, file_len, PROT_WRITE, MAP_SHARED, fd, 0);
>        if (buf == MAP_FAILED) {
>                perror("mmap");
>                goto out;
>        }
>        if (mlock(buf, file_len) < 0) {
>                perror("mlock");
>                goto out;
>        }

Thanks Tao for tracing this to an individual change. I can reproduce
this on my system. The issue is that the file is mapped without the
PROT_READ permission, so mlock can't fault in the pages. Up to 2.6.37
this worked because mlock was using a write.

The test case does show there was a behavior change; however it's not
clear to me that the tested behavior is valid.

I can see two possible resolutions:

1- do nothing, if we can agree that the test case is invalid

2- restore the previous behavior for writable, non-readable, shared
mappings while preserving the optimization for read/write shared
mappings. The test would then look like:
if ((vma->vm_flags & VM_WRITE) && (vma->vm_flags & (VM_READ |
gup_flags |= FOLL_WRITE;

Michel "Walken" Lespinasse
A program is never fully debugged until the last user dies.
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2011-01-30 11:29    [W:0.037 / U:40.820 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site