From: Hugh Dickins <hughd@google.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Hugh Dickins <hughd@google.com>,
Christoph Hellwig <hch@infradead.org>,
Theodore Ts'o <tytso@mit.edu>, Al Viro <viro@zeniv.linux.org.uk>,
Alex Elder <elder@kernel.org>,
Andreas Dilger <adilger.kernel@dilger.ca>,
Ben Myers <bpm@sgi.com>, Dave Chinner <david@fromorbit.com>,
Joel Becker <jlbec@evilplan.org>, Mark Fasheh <mfasheh@suse.com>,
linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
linux-mm@kvack.org
Subject: Re: [PATCH] mm for fs: add truncate_pagecache_range
Date: Sun, 25 Mar 2012 14:55:36 -0700 (PDT) [thread overview]
Message-ID: <alpine.LSU.2.00.1203251426540.1609@eggly.anvils> (raw)
In-Reply-To: <20120325135002.185b4caf.akpm@linux-foundation.org>
On Sun, 25 Mar 2012, Andrew Morton wrote:
> On Sun, 25 Mar 2012 13:26:10 -0700 (PDT) Hugh Dickins <hughd@google.com> wrote:
> > truncate_pagecache_range() is just a drop-in replacement for
> > truncate_inode_pages_range(), and has no different locking needs.
>
> Does anything prevent new pages from getting added to pagecache and
> perhaps faulted into VMAs after or during the execution of these
> functions?
If a page is faulted into a vma after the unmap_mapping_range() but
before truncate_inode_pages_range() reaches it, then it gets unmapped
by the fallback unmap_mapping_range(), called from truncate_inode_page()
while holding page lock.
A new page could be faulted in a moment after; but last year I did
change truncate_inode_pages_range() slightly, pinching down on the range
instead of just the ascending linear scan, so it doesn't return until
the range is empty of pages (excepting rcu races, which I think mean
there's no exact instant of return which all cpus would agree upon).
A new page could be faulted in a moment after that, and then it survives:
unlike in the truncation case, there's no equivalent of i_size to
determine whether to SIGBUS. (But even in the truncation case, a
truncate or write to increase i_size may follow an instant later.)
Individual filesystems may impose additional constraints to guarantee
their own internal consistency; and tmpfs certainly finds inode->i_mutex
useful for that, to serialize between holepunch and truncate and write.
I wouldn't be surprised if other filesystems found it useful too,
but that's up to them - truncate_pagecache_range() doesn't need it.
>
> Also, I wonder what prevents pages in the range from being dirtied
> between ext4_ext_punch_hole()'s filemap_write_and_wait_range() and
> truncate_inode_pages_range().
I'm not going to guess on that, or whether it matters: Ted?
Hugh
--
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 internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2012-03-25 21:56 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-23 20:46 Hugh Dickins
2012-03-23 21:01 ` Andrew Morton
2012-03-23 21:14 ` Hugh Dickins
2012-03-23 22:59 ` Andrew Morton
2012-03-25 20:26 ` Hugh Dickins
2012-03-25 20:50 ` Andrew Morton
2012-03-25 21:55 ` Hugh Dickins [this message]
2012-04-03 5:45 ` Joel Becker
2012-05-13 21:03 ` Hugh Dickins
2012-05-17 9:25 ` Joel Becker
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=alpine.LSU.2.00.1203251426540.1609@eggly.anvils \
--to=hughd@google.com \
--cc=adilger.kernel@dilger.ca \
--cc=akpm@linux-foundation.org \
--cc=bpm@sgi.com \
--cc=david@fromorbit.com \
--cc=elder@kernel.org \
--cc=hch@infradead.org \
--cc=jlbec@evilplan.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mfasheh@suse.com \
--cc=tytso@mit.edu \
--cc=viro@zeniv.linux.org.uk \
/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