linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/17] Add folio_end_read
@ 2023-09-15 18:36 Matthew Wilcox (Oracle)
  2023-09-15 18:36 ` [PATCH 01/17] iomap: Hold state_lock over call to ifs_set_range_uptodate() Matthew Wilcox (Oracle)
                   ` (17 more replies)
  0 siblings, 18 replies; 45+ messages in thread
From: Matthew Wilcox (Oracle) @ 2023-09-15 18:36 UTC (permalink / raw)
  To: linux-kernel
  Cc: Matthew Wilcox (Oracle), linux-fsdevel, linux-arch, torvalds,
	Nicholas Piggin

The core of this patchset is the new folio_end_read() call which
filesystems can use when finishing a page cache read instead of separate
calls to mark the folio uptodate and unlock it.  As an illustration of
its use, I converted ext4, iomap & mpage; more can be converted.

I think that's useful by itself, but the interesting optimisation is
that we can implement that with a single XOR instruction that sets the
uptodate bit, clears the lock bit, tests the waiter bit and provides a
write memory barrier.  That removes one memory barrier and one atomic
instruction from each page read, which seems worth doing.  That's in
patch 15.

The last two patches could be a separate series, but basically we can do
the same thing with the writeback flag that we do with the unlock flag;
clear it and test the waiters bit at the same time.

I don't have any performance numbers; I'm hoping Nick might provide some
since PPC seems particularly unhappy with write-after-write hazards.

Matthew Wilcox (Oracle) (17):
  iomap: Hold state_lock over call to ifs_set_range_uptodate()
  iomap: Protect read_bytes_pending with the state_lock
  mm: Add folio_end_read()
  ext4: Use folio_end_read()
  buffer: Use folio_end_read()
  iomap: Use folio_end_read()
  bitops: Add xor_unlock_is_negative_byte()
  alpha: Implement xor_unlock_is_negative_byte
  m68k: Implement xor_unlock_is_negative_byte
  mips: Implement xor_unlock_is_negative_byte
  powerpc: Implement arch_xor_unlock_is_negative_byte on 32-bit
  riscv: Implement xor_unlock_is_negative_byte
  s390: Implement arch_xor_unlock_is_negative_byte
  mm: Delete checks for xor_unlock_is_negative_byte()
  mm: Add folio_xor_flags_has_waiters()
  mm: Make __end_folio_writeback() return void
  mm: Use folio_xor_flags_has_waiters() in folio_end_writeback()

 arch/alpha/include/asm/bitops.h               | 20 +++++
 arch/m68k/include/asm/bitops.h                | 13 ++++
 arch/mips/include/asm/bitops.h                | 25 +++++-
 arch/mips/lib/bitops.c                        | 14 ++++
 arch/powerpc/include/asm/bitops.h             | 21 ++---
 arch/riscv/include/asm/bitops.h               | 12 +++
 arch/s390/include/asm/bitops.h                | 10 +++
 arch/x86/include/asm/bitops.h                 | 11 ++-
 fs/buffer.c                                   | 16 +---
 fs/ext4/readpage.c                            | 14 +---
 fs/iomap/buffered-io.c                        | 55 ++++++++-----
 .../asm-generic/bitops/instrumented-lock.h    | 28 ++++---
 include/asm-generic/bitops/lock.h             | 20 +----
 include/linux/page-flags.h                    | 19 +++++
 include/linux/pagemap.h                       |  1 +
 kernel/kcsan/kcsan_test.c                     |  9 +--
 kernel/kcsan/selftest.c                       |  9 +--
 mm/filemap.c                                  | 77 ++++++++++---------
 mm/kasan/kasan_test.c                         |  8 +-
 mm/page-writeback.c                           | 35 ++++-----
 20 files changed, 248 insertions(+), 169 deletions(-)

-- 
2.40.1


^ permalink raw reply	[flat|nested] 45+ messages in thread

end of thread, other threads:[~2023-10-04 12:36 UTC | newest]

Thread overview: 45+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-15 18:36 [PATCH 00/17] Add folio_end_read Matthew Wilcox (Oracle)
2023-09-15 18:36 ` [PATCH 01/17] iomap: Hold state_lock over call to ifs_set_range_uptodate() Matthew Wilcox (Oracle)
2023-09-15 18:36 ` [PATCH 02/17] iomap: Protect read_bytes_pending with the state_lock Matthew Wilcox (Oracle)
2023-09-16  0:11   ` Linus Torvalds
2023-09-16  0:15     ` Linus Torvalds
2023-09-16 15:50     ` Matthew Wilcox
2023-09-15 18:36 ` [PATCH 03/17] mm: Add folio_end_read() Matthew Wilcox (Oracle)
2023-09-15 18:36 ` [PATCH 04/17] ext4: Use folio_end_read() Matthew Wilcox (Oracle)
2023-09-15 18:36 ` [PATCH 05/17] buffer: " Matthew Wilcox (Oracle)
2023-09-15 18:36 ` [PATCH 06/17] iomap: " Matthew Wilcox (Oracle)
2023-09-15 18:36 ` [PATCH 07/17] bitops: Add xor_unlock_is_negative_byte() Matthew Wilcox (Oracle)
2023-09-15 18:36 ` [PATCH 08/17] alpha: Implement xor_unlock_is_negative_byte Matthew Wilcox (Oracle)
2023-09-16  0:27   ` Linus Torvalds
2023-09-16  0:38     ` Matthew Wilcox
2023-09-16  2:01       ` Linus Torvalds
2023-09-16  2:14         ` Linus Torvalds
2023-09-16 15:59         ` Matthew Wilcox
2023-09-15 18:36 ` [PATCH 09/17] m68k: " Matthew Wilcox (Oracle)
2023-09-16 13:11   ` Greg Ungerer
2023-09-16 14:34     ` Matthew Wilcox
2023-09-18 14:37       ` Greg Ungerer
2023-09-20  7:45         ` Greg Ungerer
2023-09-20 16:58           ` Linus Torvalds
2023-09-19 13:23       ` David Laight
2023-09-19 14:26         ` Matthew Wilcox
2023-09-19 14:35           ` David Laight
2023-09-19 15:14             ` Matthew Wilcox
2023-09-19 15:22               ` David Laight
2023-09-19 15:47                 ` Matthew Wilcox
2023-09-19 15:57                   ` David Laight
2023-09-20  7:15                     ` Greg Ungerer
2023-09-20  7:22               ` Greg Ungerer
2023-10-02 20:07                 ` Matthew Wilcox
2023-10-03 14:14                   ` Greg Ungerer
2023-10-03 20:07                     ` Matthew Wilcox
2023-10-04 12:06                       ` Greg Ungerer
2023-09-15 18:37 ` [PATCH 10/17] mips: " Matthew Wilcox (Oracle)
2023-09-15 18:37 ` [PATCH 11/17] powerpc: Implement arch_xor_unlock_is_negative_byte on 32-bit Matthew Wilcox (Oracle)
2023-09-15 18:37 ` [PATCH 12/17] riscv: Implement xor_unlock_is_negative_byte Matthew Wilcox (Oracle)
2023-09-15 18:37 ` [PATCH 13/17] s390: Implement arch_xor_unlock_is_negative_byte Matthew Wilcox (Oracle)
2023-09-15 18:37 ` [PATCH 14/17] mm: Delete checks for xor_unlock_is_negative_byte() Matthew Wilcox (Oracle)
2023-09-15 18:37 ` [PATCH 15/17] mm: Add folio_xor_flags_has_waiters() Matthew Wilcox (Oracle)
2023-09-15 18:37 ` [PATCH 16/17] mm: Make __end_folio_writeback() return void Matthew Wilcox (Oracle)
2023-09-15 18:37 ` [PATCH 17/17] mm: Use folio_xor_flags_has_waiters() in folio_end_writeback() Matthew Wilcox (Oracle)
2023-09-16  0:31 ` [PATCH 00/17] Add folio_end_read Linus Torvalds

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).