linux-stable/Documentation/filesystems
Ryan Roberts 3485b88390 mm: thp: introduce multi-size THP sysfs interface
In preparation for adding support for anonymous multi-size THP, introduce
new sysfs structure that will be used to control the new behaviours.  A
new directory is added under transparent_hugepage for each supported THP
size, and contains an `enabled` file, which can be set to "inherit" (to
inherit the global setting), "always", "madvise" or "never".  For now, the
kernel still only supports PMD-sized anonymous THP, so only 1 directory is
populated.

The first half of the change converts transhuge_vma_suitable() and
hugepage_vma_check() so that they take a bitfield of orders for which the
user wants to determine support, and the functions filter out all the
orders that can't be supported, given the current sysfs configuration and
the VMA dimensions.  The resulting functions are renamed to
thp_vma_suitable_orders() and thp_vma_allowable_orders() respectively. 
Convenience functions that take a single, unencoded order and return a
boolean are also defined as thp_vma_suitable_order() and
thp_vma_allowable_order().

The second half of the change implements the new sysfs interface.  It has
been done so that each supported THP size has a `struct thpsize`, which
describes the relevant metadata and is itself a kobject.  This is pretty
minimal for now, but should make it easy to add new per-thpsize files to
the interface if needed in future (e.g.  per-size defrag).  Rather than
keep the `enabled` state directly in the struct thpsize, I've elected to
directly encode it into huge_anon_orders_[always|madvise|inherit]
bitfields since this reduces the amount of work required in
thp_vma_allowable_orders() which is called for every page fault.

See Documentation/admin-guide/mm/transhuge.rst, as modified by this
commit, for details of how the new sysfs interface works.

[ryan.roberts@arm.com: fix build warning when CONFIG_SYSFS is disabled]
  Link: https://lkml.kernel.org/r/20231211125320.3997543-1-ryan.roberts@arm.com
Link: https://lkml.kernel.org/r/20231207161211.2374093-4-ryan.roberts@arm.com
Signed-off-by: Ryan Roberts <ryan.roberts@arm.com>
Reviewed-by: Barry Song <v-songbaohua@oppo.com>
Tested-by: Kefeng Wang <wangkefeng.wang@huawei.com>
Tested-by: John Hubbard <jhubbard@nvidia.com>
Acked-by: David Hildenbrand <david@redhat.com>
Cc: Alistair Popple <apopple@nvidia.com>
Cc: Anshuman Khandual <anshuman.khandual@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: David Rientjes <rientjes@google.com>
Cc: "Huang, Ying" <ying.huang@intel.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Itaru Kitayama <itaru.kitayama@gmail.com>
Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Luis Chamberlain <mcgrof@kernel.org>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Yang Shi <shy828301@gmail.com>
Cc: Yin Fengwei <fengwei.yin@intel.com>
Cc: Yu Zhao <yuzhao@google.com>
Cc: Zi Yan <ziy@nvidia.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2023-12-20 14:48:12 -08:00
..
caching Documentation: Fix typos 2023-08-18 11:29:03 -06:00
ext4 Documentation: Fix typos 2023-08-18 11:29:03 -06:00
nfs vfs-6.7.fsid 2023-11-07 12:11:26 -08:00
smb smb3: move Documentation/filesystems/cifs to Documentation/filesystems/smb 2023-05-24 16:29:21 -05:00
spufs Documentation: spufs: correct a duplicate word typo 2022-09-27 13:21:44 -06:00
9p.rst Documentation: Fix typos 2023-08-18 11:29:03 -06:00
adfs.rst
affs.rst affs: fix basic permission bits to actually work 2020-08-31 12:20:31 +02:00
afs.rst afs: Documentation: correct reference to CONFIG_AFS_FS 2023-07-21 13:46:02 -06:00
api-summary.rst block: move fs/block_dev.c to block/bdev.c 2021-09-07 08:39:40 -06:00
autofs-mount-control.rst autofs: use flexible array in ioctl structure 2023-05-30 16:42:00 -07:00
autofs.rst autofs: use flexible array in ioctl structure 2023-05-30 16:42:00 -07:00
automount-support.rst
befs.rst Documentation: Fix typos 2023-08-18 11:29:03 -06:00
bfs.rst
btrfs.rst MAINTAINERS: remove links to obsolete btrfs.wiki.kernel.org 2023-09-08 14:21:27 +02:00
ceph.rst ceph: update documentation regarding snapshot naming limitations 2023-08-24 11:24:36 +02:00
coda.rst
configfs.rst Documentation: Fix typos 2023-08-18 11:29:03 -06:00
cramfs.rst
dax.rst Documentation: Fix typos 2023-08-18 11:29:03 -06:00
debugfs.rst debugfs: small Documentation cleaning 2022-11-09 13:58:55 -07:00
devpts.rst Documentation: Fix typos 2023-08-18 11:29:03 -06:00
directory-locking.rst fs: Lock moved directories 2023-06-02 15:00:18 +02:00
dlmfs.rst docs: update ocfs2-devel mailing list address 2023-07-08 09:29:29 -07:00
dnotify.rst
ecryptfs.rst
efivarfs.rst
erofs.rst MAINTAINERS: erofs: add EROFS webpage 2023-11-17 19:55:46 +08:00
ext2.rst ext2: remove nobh support 2022-08-02 12:34:04 -04:00
ext3.rst
f2fs.rst Documentation: Fix typos 2023-08-18 11:29:03 -06:00
fiemap.rst
files.rst file: convert to SLAB_TYPESAFE_BY_RCU 2023-10-19 11:02:48 +02:00
fscrypt.rst fscrypt: track master key presence separately from secret 2023-10-16 21:23:45 -07:00
fsverity.rst ovl: Add framework for verity support 2023-08-12 19:02:38 +03:00
fuse-io.rst
fuse.rst fuse: Add module param for CAP_SYS_ADMIN access bypassing allow_other 2022-07-21 16:06:19 +02:00
gfs2-glocks.rst gfs2 fixes 2023-09-05 13:00:28 -07:00
gfs2-uevents.rst
gfs2.rst Documentation: Update filesystems/gfs2.rst 2020-12-01 00:25:20 +01:00
hfs.rst
hfsplus.rst
hpfs.rst
idmappings.rst Documentation work keeps chugging along; stuff for 6.6 includes: 2023-08-30 20:05:42 -07:00
index.rst docs: add maintainer entry profile for XFS 2023-08-10 07:47:53 -07:00
inotify.rst
isofs.rst
journalling.rst jbd2: drop jbd2_fc_init documentation 2020-11-06 23:01:03 -05:00
locking.rst fs: convert error_remove_page to error_remove_folio 2023-12-10 16:51:42 -08:00
locks.rst docs: fs: locks.rst: update comment about mandatory file locking 2021-10-19 06:48:21 -04:00
mount_api.rst fs_context: drop the unused lsm_flags member 2023-03-16 14:38:28 +01:00
netfs_library.rst Documentation: Fix typos 2023-08-18 11:29:03 -06:00
nilfs2.rst Documentation: Fix typos 2023-08-18 11:29:03 -06:00
ntfs.rst
ntfs3.rst Documentation: Fix typos 2023-08-18 11:29:03 -06:00
ocfs2-online-filecheck.rst
ocfs2.rst docs: update ocfs2-devel mailing list address 2023-07-08 09:29:29 -07:00
omfs.rst
orangefs.rst Documentation: Fix typos 2023-08-18 11:29:03 -06:00
overlayfs.rst ovl: add support for appending lowerdirs one by one 2023-10-31 00:13:02 +02:00
path-lookup.rst Merge branch 'work.namei' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2021-07-03 11:41:14 -07:00
path-lookup.txt
porting.rst vfs-6.7.fsid 2023-11-07 12:11:26 -08:00
proc.rst mm: thp: introduce multi-size THP sysfs interface 2023-12-20 14:48:12 -08:00
qnx6.rst Documentation: Fix typos 2023-08-18 11:29:03 -06:00
quota.rst
ramfs-rootfs-initramfs.rst Documentation/filesystems: ramfs-rootfs-initramfs: use :Author: 2023-05-16 12:55:35 -06:00
relay.rst
romfs.rst
seq_file.rst Documentation: Fix typos 2023-08-18 11:29:03 -06:00
sharedsubtree.rst Documentation/filesystems: sharedsubtree: add section headings 2023-05-16 12:50:05 -06:00
splice.rst
squashfs.rst
sysfs.rst driver core: bus: mark the struct bus_type for sysfs callbacks as constant 2023-03-23 13:20:40 +01:00
sysv-fs.rst
tmpfs.rst tmpfs,xattr: enable limited user extended attributes 2023-08-10 12:06:04 +02:00
ubifs-authentication.rst Documentation: Fix typos 2023-08-18 11:29:03 -06:00
ubifs.rst Documentation: ubifs: Fix compression idiom 2022-10-10 13:01:10 -06:00
udf.rst
vfat.rst Documentation: Fix typos 2023-08-18 11:29:03 -06:00
vfs.rst fs: convert error_remove_page to error_remove_folio 2023-12-10 16:51:42 -08:00
virtiofs.rst
xfs-delayed-logging-design.rst Documentation: filesystems: correct possessive "its" 2022-09-27 13:21:44 -06:00
xfs-maintainer-entry-profile.rst docs: add maintainer entry profile for XFS 2023-08-10 07:47:53 -07:00
xfs-online-fsck-design.rst Documentation: xfs: Remove repeated word in comments 2023-09-22 05:20:09 -06:00
xfs-self-describing-metadata.rst xfs: document the filesystem metadata checking strategy 2023-04-11 18:59:47 -07:00
zonefs.rst Documentation: Fix typos 2023-08-18 11:29:03 -06:00