From: Jinliang Zheng <alexjlzheng@gmail.com>
To: willy@infradead.org
Cc: alexjlzheng@gmail.com, alexjlzheng@tencent.com,
brauner@kernel.org, djwong@kernel.org, hch@infradead.org,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-mm@kvack.org, linux-xfs@vger.kernel.org
Subject: Re: [PATCH] iomap: avoid unnecessary ifs_set_range_uptodate() with locks
Date: Mon, 7 Jul 2025 12:08:16 +0800 [thread overview]
Message-ID: <20250707040816.3062776-1-alexjlzheng@tencent.com> (raw)
In-Reply-To: <aGa_HFAupmxO_iri@casper.infradead.org>
On Thu, 3 Jul 2025 18:34:20 +0100, Matthew Wilcox wrote:
> On Thu, Jul 03, 2025 at 06:52:44AM -0700, Christoph Hellwig wrote:
> > On Tue, Jul 01, 2025 at 10:48:47PM +0800, alexjlzheng@gmail.com wrote:
> > > From: Jinliang Zheng <alexjlzheng@tencent.com>
> > >
> > > In the buffer write path, iomap_set_range_uptodate() is called every
> > > time iomap_end_write() is called. But if folio_test_uptodate() holds, we
> > > know that all blocks in this folio are already in the uptodate state, so
> > > there is no need to go deep into the critical section of state_lock to
> > > execute bitmap_set().
> > >
> > > Although state_lock may not have significant lock contention due to
> > > folio lock, this patch at least reduces the number of instructions.
> >
> > That means the uptodate bitmap is stale in that case. That would
> > only matter if we could clear the folio uptodate bit and still
> > expect the page content to survive. Which sounds dubious and I could
> > not find anything relevant grepping the tree, but I'm adding the
> > linux-mm list just in case.
>
> Once a folio is uptodate, there is no route back to !uptodate without
> going through the removal of the folio from the page cache. The read()
> path relies on this for example; once it has a refcount on the folio,
> and has checked the uptodate bit, it will copy the contents to userspace.
I agree, and this aligns with my perspective. Thank you for confirming this.
Jinliang Zheng. :)
next prev parent reply other threads:[~2025-07-07 4:08 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-01 14:48 [PATCH] iomap: avoid unnecessary ifs_set_range_uptodate() with locks alexjlzheng
2025-07-01 18:47 ` Darrick J. Wong
2025-07-02 12:09 ` Jinliang Zheng
2025-07-02 18:52 ` Darrick J. Wong
2025-07-03 13:50 ` Christoph Hellwig
2025-07-03 14:33 ` Jinliang Zheng
2025-07-03 13:52 ` Christoph Hellwig
2025-07-03 17:34 ` Matthew Wilcox
2025-07-07 4:08 ` Jinliang Zheng [this message]
2025-07-09 3:30 ` Jinliang Zheng
2025-07-11 7:44 ` Christoph Hellwig
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=20250707040816.3062776-1-alexjlzheng@tencent.com \
--to=alexjlzheng@gmail.com \
--cc=alexjlzheng@tencent.com \
--cc=brauner@kernel.org \
--cc=djwong@kernel.org \
--cc=hch@infradead.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-xfs@vger.kernel.org \
--cc=willy@infradead.org \
/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).