From: Michel Lespinasse <walken@google.com>
To: Tao Ma <tm@tao.ma>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH] mlock: revert the optimization for dirtying pages and triggering writeback.
Date: Sun, 30 Jan 2011 02:26:27 -0800 [thread overview]
Message-ID: <AANLkTik1dt1Q9TA+JmdvkuOqmt5LB2iZ1X2B5GbBFx1+@mail.gmail.com> (raw)
In-Reply-To: <1296371720-4176-1-git-send-email-tm@tao.ma>
On Sat, Jan 29, 2011 at 11:15 PM, Tao Ma <tm@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 |
VM_SHARED)) != VM_SHARED)
gup_flags |= FOLL_WRITE;
--
Michel "Walken" Lespinasse
A program is never fully debugged until the last user dies.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom policy in Canada: sign http://dissolvethecrtc.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2011-01-30 10:26 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-30 7:15 Tao Ma
2011-01-30 10:26 ` Michel Lespinasse [this message]
2011-01-30 13:57 ` Tao Ma
2011-01-31 11:43 ` KOSAKI Motohiro
2011-01-31 15:41 ` [PATCH v2] mlock: set VM_WRITE in case we don't have read permission Tao Ma
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=AANLkTik1dt1Q9TA+JmdvkuOqmt5LB2iZ1X2B5GbBFx1+@mail.gmail.com \
--to=walken@google.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=tm@tao.ma \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox