Re: [PATCH] iomap: avoid unnecessary ifs_set_range_uptodate() with locks

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jul 03, 2025 at 06:52:44AM -0700, Christoph Hellwig wrote:
> On Tue, Jul 01, 2025 at 10:48:47PM +0800, alexjlzheng@xxxxxxxxx wrote:
> > From: Jinliang Zheng <alexjlzheng@xxxxxxxxxxx>
> > 
> > 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.




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux