linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 00/25] Page folios
@ 2021-01-28  7:03 Matthew Wilcox (Oracle)
  2021-01-28  7:03 ` [PATCH v3 01/25] mm: Introduce struct folio Matthew Wilcox (Oracle)
                   ` (24 more replies)
  0 siblings, 25 replies; 35+ messages in thread
From: Matthew Wilcox (Oracle) @ 2021-01-28  7:03 UTC (permalink / raw)
  To: linux-fsdevel, linux-mm; +Cc: Matthew Wilcox (Oracle), linux-kernel

Some functions which take a struct page as an argument operate on
PAGE_SIZE bytes.  Others operate on the entire compound page if
passed either a head or tail page.  Others operate on the compound
page if passed a head page, but PAGE_SIZE bytes if passed a tail page.
Yet others either BUG or do the wrong thing if passed a tail page.

This patch series starts to resolve this ambiguity by introducing a new
type, the struct folio.  A function which takes a struct folio argument
declares that it will operate on the entire page.  In return, the caller
guarantees that the pointer it is passing does not point to a tail page.

This allows us to do less work.  Now we have a type that is guaranteed
not to be a tail page, we can avoid calling compound_head().  That saves
us hundreds of bytes of text and even manages to reduce the amount of
data in the kernel image somehow.

The focus for this patch series is on introducing infrastructure.
The big correctness proof that exists in this patch series is to make
it clear that one cannot wait (for the page lock or writeback) on a
tail page.  I don't believe there were any places which could miss a
wakeup due to this, but it's hard to prove that without struct folio.
Now the compiler proves it for us.

v3:
 - Rebase on next-20210127.  Two major sources of conflict, the
   generic_file_buffered_read refactoring (in akpm tree) and the
   fscache work (in dhowells tree).  Not sure how this patch series
   can get merged with these two sources of conflict?
v2:
 - Pare patch series back to just infrastructure and the page waiting
   parts.

Matthew Wilcox (Oracle) (25):
  mm: Introduce struct folio
  mm: Add folio_pgdat
  mm/vmstat: Add folio stat wrappers
  mm/debug: Add VM_BUG_ON_FOLIO and VM_WARN_ON_ONCE_FOLIO
  mm: Add put_folio
  mm: Add get_folio
  mm: Create FolioFlags
  mm: Handle per-folio private data
  mm: Add folio_index, folio_page and folio_contains
  mm/util: Add folio_mapping and folio_file_mapping
  mm/memcg: Add folio_memcg, lock_folio_memcg and unlock_folio_memcg
  mm/memcg: Add mem_cgroup_folio_lruvec
  mm: Add unlock_folio
  mm: Add lock_folio
  mm: Add lock_folio_killable
  mm: Convert lock_page_async to lock_folio_async
  mm/filemap: Convert end_page_writeback to end_folio_writeback
  mm: Convert wait_on_page_bit to wait_on_folio_bit
  mm: Add wait_for_stable_folio and wait_on_folio_writeback
  mm: Add wait_on_folio_locked & wait_on_folio_locked_killable
  mm: Convert lock_page_or_retry to lock_folio_or_retry
  mm/filemap: Convert wake_up_page_bit to wake_up_folio_bit
  mm: Convert test_clear_page_writeback to test_clear_folio_writeback
  mm/filemap: Convert page wait queues to be folios
  cachefiles: Switch to wait_page_key

 fs/afs/write.c             |  31 +++---
 fs/cachefiles/rdwr.c       |  13 ++-
 fs/io_uring.c              |   2 +-
 include/linux/memcontrol.h |  22 ++++
 include/linux/mm.h         |  88 ++++++++++++----
 include/linux/mm_types.h   |  33 ++++++
 include/linux/mmdebug.h    |  20 ++++
 include/linux/netfs.h      |   5 +
 include/linux/page-flags.h | 106 +++++++++++++++----
 include/linux/pagemap.h    | 201 ++++++++++++++++++++++++-----------
 include/linux/vmstat.h     |  60 +++++++++++
 mm/filemap.c               | 207 ++++++++++++++++++-------------------
 mm/memcontrol.c            |  36 ++++---
 mm/memory.c                |  10 +-
 mm/page-writeback.c        |  48 ++++-----
 mm/swapfile.c              |   6 +-
 mm/util.c                  |  20 ++--
 17 files changed, 621 insertions(+), 287 deletions(-)

-- 
2.29.2



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

end of thread, other threads:[~2021-03-01 22:16 UTC | newest]

Thread overview: 35+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-28  7:03 [PATCH v3 00/25] Page folios Matthew Wilcox (Oracle)
2021-01-28  7:03 ` [PATCH v3 01/25] mm: Introduce struct folio Matthew Wilcox (Oracle)
2021-03-01 20:26   ` Zi Yan
2021-03-01 20:53     ` Matthew Wilcox
2021-03-01 21:03       ` Zi Yan
2021-01-28  7:03 ` [PATCH v3 02/25] mm: Add folio_pgdat Matthew Wilcox (Oracle)
2021-03-01 21:05   ` Zi Yan
2021-01-28  7:03 ` [PATCH v3 03/25] mm/vmstat: Add folio stat wrappers Matthew Wilcox (Oracle)
2021-03-01 21:17   ` Zi Yan
2021-03-01 22:15     ` Matthew Wilcox
2021-01-28  7:03 ` [PATCH v3 04/25] mm/debug: Add VM_BUG_ON_FOLIO and VM_WARN_ON_ONCE_FOLIO Matthew Wilcox (Oracle)
2021-03-01 21:25   ` Zi Yan
2021-01-28  7:03 ` [PATCH v3 05/25] mm: Add put_folio Matthew Wilcox (Oracle)
2021-03-01 21:41   ` Zi Yan
2021-01-28  7:03 ` [PATCH v3 06/25] mm: Add get_folio Matthew Wilcox (Oracle)
2021-03-01 21:45   ` Zi Yan
2021-01-28  7:03 ` [PATCH v3 07/25] mm: Create FolioFlags Matthew Wilcox (Oracle)
2021-01-28  7:03 ` [PATCH v3 08/25] mm: Handle per-folio private data Matthew Wilcox (Oracle)
2021-01-28  7:03 ` [PATCH v3 09/25] mm: Add folio_index, folio_page and folio_contains Matthew Wilcox (Oracle)
2021-01-28  7:03 ` [PATCH v3 10/25] mm/util: Add folio_mapping and folio_file_mapping Matthew Wilcox (Oracle)
2021-01-28  7:03 ` [PATCH v3 11/25] mm/memcg: Add folio_memcg, lock_folio_memcg and unlock_folio_memcg Matthew Wilcox (Oracle)
2021-01-28  7:03 ` [PATCH v3 12/25] mm/memcg: Add mem_cgroup_folio_lruvec Matthew Wilcox (Oracle)
2021-01-28  7:03 ` [PATCH v3 13/25] mm: Add unlock_folio Matthew Wilcox (Oracle)
2021-01-28  7:03 ` [PATCH v3 14/25] mm: Add lock_folio Matthew Wilcox (Oracle)
2021-01-28  7:03 ` [PATCH v3 15/25] mm: Add lock_folio_killable Matthew Wilcox (Oracle)
2021-01-28  7:03 ` [PATCH v3 16/25] mm: Convert lock_page_async to lock_folio_async Matthew Wilcox (Oracle)
2021-01-28  7:03 ` [PATCH v3 17/25] mm/filemap: Convert end_page_writeback to end_folio_writeback Matthew Wilcox (Oracle)
2021-01-28  7:03 ` [PATCH v3 18/25] mm: Convert wait_on_page_bit to wait_on_folio_bit Matthew Wilcox (Oracle)
2021-01-28  7:03 ` [PATCH v3 19/25] mm: Add wait_for_stable_folio and wait_on_folio_writeback Matthew Wilcox (Oracle)
2021-01-28  7:03 ` [PATCH v3 20/25] mm: Add wait_on_folio_locked & wait_on_folio_locked_killable Matthew Wilcox (Oracle)
2021-01-28  7:04 ` [PATCH v3 21/25] mm: Convert lock_page_or_retry to lock_folio_or_retry Matthew Wilcox (Oracle)
2021-01-28  7:04 ` [PATCH v3 22/25] mm/filemap: Convert wake_up_page_bit to wake_up_folio_bit Matthew Wilcox (Oracle)
2021-01-28  7:04 ` [PATCH v3 23/25] mm: Convert test_clear_page_writeback to test_clear_folio_writeback Matthew Wilcox (Oracle)
2021-01-28  7:04 ` [PATCH v3 24/25] mm/filemap: Convert page wait queues to be folios Matthew Wilcox (Oracle)
2021-01-28  7:04 ` [PATCH v3 25/25] cachefiles: Switch to wait_page_key Matthew Wilcox (Oracle)

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