mm: Use multi-index entries in the page cache
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Sun, 28 Jun 2020 02:19:08 +0000 (22:19 -0400)
committerMatthew Wilcox (Oracle) <willy@infradead.org>
Sat, 8 Jan 2022 05:28:41 +0000 (00:28 -0500)
commit6b24ca4a1a8d4ee3221d6d44ddbb99f542e4bda3
tree19f30971709b643688cada0032b9b33806c633e1
parent25a8de7f8d970ffa7263bd9d32a08138cd949f17
mm: Use multi-index entries in the page cache

We currently store large folios as 2^N consecutive entries.  While this
consumes rather more memory than necessary, it also turns out to be buggy.
A writeback operation which starts within a tail page of a dirty folio will
not write back the folio as the xarray's dirty bit is only set on the
head index.  With multi-index entries, the dirty bit will be found no
matter where in the folio the operation starts.

This does end up simplifying the page cache slightly, although not as
much as I had hoped.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: William Kucharski <william.kucharski@oracle.com>
include/linux/pagemap.h
mm/filemap.c
mm/huge_memory.c
mm/khugepaged.c
mm/migrate.c
mm/shmem.c