From: Matthew Wilcox <willy@infradead.org>
To: David Howells <dhowells@redhat.com>
Cc: Miklos Szeredi <miklos@szeredi.hu>,
Trond Myklebust <trond.myklebust@hammerspace.com>,
Christoph Hellwig <hch@lst.de>,
Andrew Morton <akpm@linux-foundation.org>,
Alexander Viro <viro@zeniv.linux.org.uk>,
Christian Brauner <brauner@kernel.org>,
Jeff Layton <jlayton@kernel.org>,
linux-mm@kvack.org, linux-fsdevel@vger.kernel.org,
netfs@lists.linux.dev, v9fs@lists.linux.dev,
linux-afs@lists.infradead.org, ceph-devel@vger.kernel.org,
linux-cifs@vger.kernel.org, linux-nfs@vger.kernel.org,
devel@lists.orangefs.org, linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH v2] mm, netfs: Provide a means of invalidation without using launder_folio
Date: Wed, 27 Mar 2024 18:45:17 +0000 [thread overview]
Message-ID: <ZgRpPd1Ado-0_iYx@casper.infradead.org> (raw)
In-Reply-To: <2506007.1711562145@warthog.procyon.org.uk>
On Wed, Mar 27, 2024 at 05:55:45PM +0000, David Howells wrote:
> +int filemap_invalidate_inode(struct inode *inode, bool flush)
> +{
> + struct address_space *mapping = inode->i_mapping;
> +
> + if (!mapping || !mapping->nrpages)
> + goto out;
> +
> + /* Prevent new folios from being added to the inode. */
> + filemap_invalidate_lock(mapping);
I'm kind of surprised that the callers wouldn't want to hold that lock
over a call to this function. I guess you're working on the callers,
so you'd know better than I would, but I would have used lockdep to
assert that invalidate_lock was held.
> + if (!mapping->nrpages)
> + goto unlock;
> +
> + /* Assume there are probably PTEs only if there are mmaps. */
> + if (unlikely(!RB_EMPTY_ROOT(&mapping->i_mmap.rb_root)))
> + unmap_mapping_pages(mapping, 0, ULONG_MAX, false);
Is this optimisation worth it? We're already doing some expensive
operations here, does saving cycling the i_mmap_lock really help
anything? You'll note that unmap_mapping_pages() already does this
check inside the lock.
next prev parent reply other threads:[~2024-03-27 18:45 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-27 15:04 [RFC PATCH] mm, netfs: Provide a means of invalidation without using launder_folio David Howells
2024-03-27 15:56 ` Trond Myklebust
2024-03-27 17:46 ` Matthew Wilcox
2024-03-27 17:55 ` [RFC PATCH v2] " David Howells
2024-03-27 18:45 ` Matthew Wilcox [this message]
2024-03-27 20:37 ` David Howells
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=ZgRpPd1Ado-0_iYx@casper.infradead.org \
--to=willy@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=brauner@kernel.org \
--cc=ceph-devel@vger.kernel.org \
--cc=devel@lists.orangefs.org \
--cc=dhowells@redhat.com \
--cc=hch@lst.de \
--cc=jlayton@kernel.org \
--cc=linux-afs@lists.infradead.org \
--cc=linux-cifs@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-nfs@vger.kernel.org \
--cc=miklos@szeredi.hu \
--cc=netfs@lists.linux.dev \
--cc=trond.myklebust@hammerspace.com \
--cc=v9fs@lists.linux.dev \
--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;
as well as URLs for NNTP newsgroup(s).