From: Andy Lutomirski <luto@amacapital.net>
To: linux-kernel@vger.kernel.org
Cc: Theodore Ts'o <tytso@mit.edu>,
Dave Hansen <dave.hansen@linux.intel.com>,
xfs@oss.sgi.com, Christoph Hellwig <hch@infradead.org>,
Andy Lutomirski <luto@amacapital.net>, Jan Kara <jack@suse.cz>,
linux-ext4@vger.kernel.org, Tim Chen <tim.c.chen@linux.intel.com>
Subject: [PATCH v3 0/5] Rework mtime and ctime updates on mmaped
Date: Fri, 16 Aug 2013 16:22:07 -0700 [thread overview]
Message-ID: <cover.1376679411.git.luto@amacapital.net> (raw)
Writes via mmap currently update mtime and ctime in ->page_mkwrite.
This hurts both throughput and latency. In workloads that dirty a
large number of mmapped pages, ->page_mkwrite can be hot and
file_update_time is slow and scales poorly. Updating timestamps can
also sleep, which hurts latency for real-time workloads.
This is also a correctness issue. SuS says:
The st_ctime and st_mtime fields of a file that is mapped with
MAP_SHARED and PROT_WRITE, will be marked for update at some point
in the interval between a write reference to the mapped region and
the next call to msync() with MS_ASYNC or MS_SYNC for that portion
of the file by any process. If there is no such call, these fields
may be marked for update at any time after a write reference if
the underlying file is modified as a result.
Currently, if the same mmapped page is written twice, the timestamp
may not be update at all after the second write, whereas SuS (and
anything using timestamps to invalidate caches, backup data, etc.)
would expect the timestamp to eventually be updated.
This patchset attempts to fix both issues at once. It adds a new
address_space flag AS_CMTIME that is set atomically whenever the
system transfers a pte dirty bit to a struct page backed by the
address_space. This can happen with various locks held and when low
on memory.
Later on, a new address_space op ->flush_cmtime is called at various
points at which a filesystem should update timestamps if the file was
previously modified through mmap.
The core changes have no effect on unmodified filesystems. To opt in, a filesystem should implement ->flush_ctime (most likely by using generic_flush_cmtime) and should avoid updating timestamps in ->page_mkwrite.
I've converted ext4. If it works well, it will be easy to convert all
the other filesystems.
Changes from v2:
- The core code now interacts with filesystems only through
address_space ops, so there should be fewer layering issues.
- MS_ASYNC is handled correctly.
Changes from v1:
- inode_update_time_writable now locks against the fs freezer.
- Minor cleanups.
- Major changelog improvements.
Andy Lutomirski (5):
mm: Track mappings that have been written via ptes
fs: Add inode_update_time_writable
mm: Notify filesystems when it's time to apply a deferred cmtime
update
mm: Scan for dirty ptes and update cmtime on MS_ASYNC
ext4: Defer mmap cmtime update until writeback
fs/ext4/inode.c | 4 ++-
fs/inode.c | 72 +++++++++++++++++++++++++++++++---------
include/linux/fs.h | 10 ++++++
include/linux/pagemap.h | 11 +++++++
include/linux/writeback.h | 1 +
mm/memory.c | 7 +++-
mm/mmap.c | 9 ++++-
mm/msync.c | 83 ++++++++++++++++++++++++++++++++++++++++-------
mm/page-writeback.c | 26 +++++++++++++++
mm/rmap.c | 27 +++++++++++++--
10 files changed, 219 insertions(+), 31 deletions(-)
--
1.8.3.1
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next reply other threads:[~2013-08-16 23:22 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-16 23:22 Andy Lutomirski [this message]
2013-08-16 23:22 ` [PATCH v3 1/5] mm: Track mappings that have been written via ptes Andy Lutomirski
2013-08-16 23:22 ` [PATCH v3 2/5] fs: Add inode_update_time_writable Andy Lutomirski
2013-08-20 2:28 ` Dave Chinner
2013-08-20 3:20 ` Andy Lutomirski
2013-08-20 3:33 ` Dave Chinner
2013-08-20 4:07 ` Andy Lutomirski
2013-08-20 16:10 ` Jan Kara
2013-08-16 23:22 ` [PATCH v3 3/5] mm: Notify filesystems when it's time to apply a deferred cmtime update Andy Lutomirski
2013-08-20 2:36 ` Dave Chinner
2013-08-20 3:28 ` Andy Lutomirski
2013-08-20 4:08 ` Dave Chinner
2013-08-20 4:14 ` Andy Lutomirski
2013-08-20 16:00 ` Jan Kara
2013-08-20 16:42 ` Andy Lutomirski
2013-08-20 19:27 ` Andy Lutomirski
2013-08-20 21:48 ` Dave Chinner
2013-08-20 21:54 ` Andy Lutomirski
2013-08-20 22:43 ` Dave Chinner
2013-08-21 0:47 ` Andy Lutomirski
2013-08-21 1:33 ` Dave Chinner
2013-08-16 23:22 ` [PATCH v3 4/5] mm: Scan for dirty ptes and update cmtime on MS_ASYNC Andy Lutomirski
2013-08-16 23:22 ` [PATCH v3 5/5] ext4: Defer mmap cmtime update until writeback Andy Lutomirski
2013-08-20 2:38 ` Dave Chinner
2013-08-20 3:30 ` Andy Lutomirski
2013-08-20 4:08 ` Dave Chinner
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=cover.1376679411.git.luto@amacapital.net \
--to=luto@amacapital.net \
--cc=dave.hansen@linux.intel.com \
--cc=hch@infradead.org \
--cc=jack@suse.cz \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tim.c.chen@linux.intel.com \
--cc=tytso@mit.edu \
--cc=xfs@oss.sgi.com \
/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;
as well as URLs for NNTP newsgroup(s).