State of removing page->index
Subsystems (3)
My project for the next few weeks is removing page->index.
The last patch in the series is mostly:
+++ b/include/linux/mm_types.h
@@ -103,7 +103,7 @@ struct page {
/* See page-flags.h for PAGE_MAPPING_FLAGS */
struct address_space *mapping;
union {- pgoff_t index; /* Our offset within map
ping. */
+ pgoff_t __folio_index; /* Our offset wi
thin mapping. */
unsigned long share; /* share count for fsdax */
};
/**This is a stepping stone to shrinking struct page by half (64 bytes down to 32 bytes) [1] and allocating struct folio separately from struct page. It's currently 15 patches:
bootmem: Stop using page->index
mm: Constify page_address_in_vma()
mm: Convert page_to_pgoff() to page_pgoff()
mm: Mass constification of folio/page pointers
fs: Turn page_offset() into a wrapper around folio_pos()
fs: Remove page_mkwrite_check_truncate()
mm: Remove references to page->index in huge_memory.c
mm: Use page->private instead of page->index in percpu
perf: Remove setting of page->index and ->mapping
dax: Remove access to page->index
null_blk: Remove accesses to page->index
watch_queue: Use page->private instead of page->index
isofs: Partially convert zisofs_read_folio to use a folio
dax: Use folios more widely within DAX
mm: Rename page->index to page->__folio_indexI haven't pushed the git tree because the build bots will choke on the following files which still use page->index:
drivers/hwtracing/intel_th/msu.cdrivers/net/ethernet/sun/niu.cdrivers/staging/fbtft/fbtft-core.cdrivers/video/fbdev/core/fb_defio.cfs/btrfs/compression.cfs/btrfs/extent_io.cfs/btrfs/file.cfs/btrfs/super.cfs/ceph/addr.cfs/ceph/dir.cfs/ceph/inode.cfs/crypto/crypto.cfs/ecryptfs/crypto.cfs/ecryptfs/mmap.cfs/ecryptfs/read_write.cfs/erofs/data.cfs/f2fs/checkpoint.cfs/f2fs/compress.cfs/f2fs/data.cfs/f2fs/dir.cfs/f2fs/file.cfs/f2fs/inline.cfs/f2fs/inode.cfs/f2fs/node.cfs/f2fs/segment.cfs/f2fs/super.cfs/fuse/file.cfs/jffs2/file.cfs/jfs/jfs_metapage.cfs/ntfs3/frecord.cfs/ocfs2/alloc.cfs/ocfs2/aops.cfs/ocfs2/mmap.cfs/reiserfs/file.cfs/reiserfs/inode.cfs/smb/client/smb2ops.cfs/squashfs/file.cfs/squashfs/page_actor.cfs/ufs/dir.cmm/zsmalloc.c
Some of these will be fixed with scheduled pull requests (jfs), or are improved (and maybe solved) by other pending series (ufs, ecryptfs, jffs2, zsmalloc).
Expect to see a few patches from me over the next few weeks that seem random; there is a destination in mind, and if everything lines up, we might be able to get to it by the next merge window. Probably something will miss landing in v6.12 and it'll be the v6.13 release before page->index goes away entirely.
I believe I have someone lined up to help with ocfs2. If anyone wants to help with the remaining filesystems (btrfs & f2fs in particular!), let me know. I'm honestly tempted to mark reiserfs BROKEN at this point.
The diffstat of what I currently have looks like this:
arch/x86/mm/init_64.c | 9 +++---- drivers/block/null_blk/main.c | 8 +++--- drivers/dax/device.c | 9 +++---- fs/ceph/addr.c | 11 ++++---- fs/dax.c | 53 ++++++++++++++++++++------------------- fs/isofs/compress.c | 13 +++++----- include/linux/bootmem_info.h | 25 +++++++++++++------ include/linux/ksm.h | 7 +++--- include/linux/mm_types.h | 6 ++--- include/linux/pagemap.h | 58 ++++++------------------------------------- include/linux/rmap.h | 12 ++++----- kernel/events/core.c | 2 -- kernel/watch_queue.c | 4 +-- mm/bootmem_info.c | 11 ++++---- mm/huge_memory.c | 18 +++++++------- mm/internal.h | 13 +++++++--- mm/ksm.c | 5 ++-- mm/memory-failure.c | 28 +++++++++++---------- mm/page_vma_mapped.c | 5 ++-- mm/percpu.c | 4 +-- mm/rmap.c | 18 ++++++++------ mm/sparse.c | 8 +++--- mm/util.c | 2 +- 23 files changed, 153 insertions(+), 176 deletions(-)
... mostly it's a 1:1 replacement of page with folio, or ->index with ->private, but we get to delete some stuff along the way.
[1] https://kernelnewbies.org/MatthewWilcox/Memdescs/Path
Yes, page->mapping is next on the list in case you're touching a page->index and notice a page->mapping next door to it.