linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] Avoid dirtying pages during mlock
@ 2010-11-17 12:23 Michel Lespinasse
  2010-11-17 12:23 ` [PATCH 1/3] do_wp_page: remove the 'reuse' flag Michel Lespinasse
                   ` (2 more replies)
  0 siblings, 3 replies; 28+ messages in thread
From: Michel Lespinasse @ 2010-11-17 12:23 UTC (permalink / raw)
  To: linux-mm
  Cc: linux-kernel, Andrew Morton, Hugh Dickins, Rik van Riel,
	Kosaki Motohiro, Peter Zijlstra, Nick Piggin, Theodore Tso,
	Michael Rubin, Suleiman Souhlal

As discussed in linux-mm, mlocking a shared, writable vma currently causes
the corresponding pages to be marked as dirty and queued for writeback.
This seems rather unnecessary given that the pages are not being actually
modified during mlock. It is understood that for non-shared mappings
(file or anon) we want to use a write fault in order to break COW, but
there is just no such need for shared mappings.

The first two patches in this series do not introduce any behavior change.
The intent there is to make it obvious that dirtying file pages is
only done in the (writable, shared) case.  I think this clarifies the
code, but I wouldn't mind dropping these two patches if there is no
consensus about them.

The last patch is where we actually avoid dirtying shared mappings
during mlock. Note that as a side effect of this, we won't call
page_mkwrite() for the mappings that define it, and won't be
pre-allocating data blocks at the FS level if the mapped file was
sparsely allocated. My understanding is that mlock does not need to
provide such guarantee, as evidenced by the fact that it never did for
the filesystems that don't define page_mkwrite() - including some
common ones like ext3. However, I would like to gather feedback on this
from filesystem people as a precaution. If this turns out to be a
showstopper, maybe block preallocation can be added back on using a
different interface.

Large shared mlocks are getting significantly (>2x) faster in my tests,
as the disk can be fully used for reading the file instead of having to
share between this and writeback.

Michel Lespinasse (3):
  do_wp_page: remove the 'reuse' flag
  do_wp_page: clarify dirty_page handling
  mlock: avoid dirtying pages and triggering writeback

 mm/memory.c |   90 ++++++++++++++++++++++++++++++++---------------------------
 mm/mlock.c  |    7 ++++-
 2 files changed, 55 insertions(+), 42 deletions(-)

-- 
1.7.3.1


^ permalink raw reply	[flat|nested] 28+ messages in thread

end of thread, other threads:[~2010-11-20  0:30 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-17 12:23 [PATCH 0/3] Avoid dirtying pages during mlock Michel Lespinasse
2010-11-17 12:23 ` [PATCH 1/3] do_wp_page: remove the 'reuse' flag Michel Lespinasse
2010-11-17 12:23 ` [PATCH 2/3] do_wp_page: clarify dirty_page handling Michel Lespinasse
2010-11-17 12:23 ` [PATCH 3/3] mlock: avoid dirtying pages and triggering writeback Michel Lespinasse
2010-11-17 12:57   ` Nick Piggin
2010-11-17 15:28     ` Peter Zijlstra
2010-11-17 22:05       ` Michel Lespinasse
2010-11-17 22:18         ` Peter Zijlstra
2010-11-17 23:11         ` Dave Chinner
2010-11-17 23:31           ` Michel Lespinasse
2010-11-19  1:46             ` Dave Chinner
2010-11-17 23:52           ` Ted Ts'o
2010-11-18  0:53             ` Andrew Morton
2010-11-18 11:03               ` Michel Lespinasse
2010-11-18 13:37           ` Christoph Hellwig
2010-11-18 17:41             ` Hugh Dickins
2010-11-19  7:23               ` Michel Lespinasse
2010-11-19 13:42                 ` Theodore Tso
2010-11-19 15:06                   ` Christoph Hellwig
2010-11-19 22:54                 ` Andrew Morton
2010-11-19 23:22                   ` Ted Ts'o
2010-11-20  0:29                     ` Dustin Kirkland
2010-11-19 23:31                   ` Michel Lespinasse
2010-11-19 23:54                 ` Dave Chinner
2010-11-18  5:46       ` Nick Piggin
2010-11-18 10:43         ` Theodore Tso
2010-11-18 13:39           ` Christoph Hellwig
2010-11-18 18:00             ` Hugh Dickins

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).