mm-shmem-add-multi-size-thp-sysfs-interface-for-anonymous-shmem.patch removed from -mm tree
The quilt patch titled
Subject: mm: shmem: add multi-size THP sysfs interface for anonymous shmem
has been removed from the -mm tree. Its filename was
mm-shmem-add-multi-size-thp-sysfs-interface-for-anonymous-shmem.patch
This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
------------------------------------------------------
From: Baolin Wang <[email protected]>
Subject: mm: shmem: add multi-size THP sysfs interface for anonymous shmem
Date: Tue, 11 Jun 2024 18:11:07 +0800
To support the use of mTHP with anonymous shmem, add a new sysfs interface 'shmem_enabled' in the '/sys/kernel/mm/transparent_hugepage/hugepages-kB/' directory for each mTHP to control whether shmem is enabled for that mTHP, with a value similar to the top level 'shmem_enabled', which can be set
to: "always", "inherit (to inherit the top level setting)", "within_size", "advise", "never". An 'inherit' option is added to ensure compatibility with these global settings, and the options 'force' and 'deny' are dropped, which are rather testing artifacts from the old ages.
By default, PMD-sized hugepages have enabled="inherit" and all other hugepage sizes have enabled="never" for '/sys/kernel/mm/transparent_hugepage/hugepages-xxkB/shmem_enabled'.
In addition, if top level value is 'force', then only PMD-sized hugepages have enabled="inherit", otherwise configuration will be failed and vice versa. That means now we will avoid using non-PMD sized THP to override the global huge allocation.
---
Documentation/admin-guide/mm/transhuge.rst | 25 ++++ include/linux/huge_mm.h | 10 + mm/huge_memory.c | 12 -- mm/shmem.c | 96 +++++++++++++++++++ 4 files changed, 135 insertions(+), 8 deletions(-)
Documentation/admin-guide/mm/transhuge.rst renamed from Documentation/admin-guide/mm/transhuge.rst~mm-shmem-add-multi-size-thp-sysfs-interface-for-anonymous-shmem +25 -0
@@ -332,6 +332,31 @@ deny force Force the huge option on for all - very useful for testing; +Shmem can also use "multi-size THP" (mTHP) by adding a new sysfs knob to +control mTHP allocation: +'/sys/kernel/mm/transparent_hugepage/hugepages-<size>kB/shmem_enabled', +and its value for each mTHP is essentially consistent with the global +setting. An 'inherit' option is added to ensure compatibility with these +global settings. Conversely, the options 'force' and 'deny' are dropped, +which are rather testing artifacts from the old ages. + +always + Attempt to allocate <size> huge pages every time we need a new page; + +inherit + Inherit the top-level "shmem_enabled" value. By default, PMD-sized hugepages + have enabled="inherit" and all other hugepage sizes have enabled="never"; + +never + Do not allocate <size> huge pages; + +within_size + Only allocate <size> huge page if it will be fully within i_size. + Also respect fadvise()/madvise() hints; + +advise + Only allocate <size> huge pages if requested with fadvise()/madvise(); + Need of application restart ===========================
include/linux/huge_mm.h renamed from include/linux/huge_mm.h~mm-shmem-add-multi-size-thp-sysfs-interface-for-anonymous-shmem +10 -0
@@ -6,6 +6,7 @@#include <linux/mm_types.h> #include <linux/fs.h> /* only for vma_is_dax() */ +#include <linux/kobject.h> vm_fault_t do_huge_pmd_anonymous_page (struct vm_fault *vmf); int copy_huge_pmd(struct mm_struct *dst_mm, struct mm_struct *src_mm,
@@ -63,6 +64,7 @@ ssize_t single_hugepage_flag_show(struct struct kobj_attribute *attr, char *buf, enum transparent_hugepage_flag flag);extern struct kobj_attribute shmem_enabled_attr; +extern struct kobj_attribute thpsize_shmem_enabled_attr;/* * Mask of all large folio orders supported for anonymous THP; all orders up to
@@ -265,6 +267,14 @@ unsigned long thp_vma_allowable_orders(sreturn __thp_vma_allowable_orders (vma, vm_flags, tva_flags, orders); } +struct thpsize { +struct kobject kobj; +struct list_head node; +int order; +}; + +#define to_thpsize (kobj) container_of(kobj, struct thpsize, kobj) +enum mthp_stat_item {MTHP_STAT_ANON_FAULT_ALLOC ,MTHP_STAT_ANON_FAULT_FALLBACK ,
mm/huge_memory.c renamed from mm/huge_memory.c~mm-shmem-add-multi-size-thp-sysfs-interface-for-anonymous-shmem +4 -8
@@ -20,6 +20,7 @@#include <linux/swapops.h> #include <linux/backing-dev.h> #include <linux/dax.h> +#include <linux/mm_types.h> #include <linux/khugepaged.h> #include <linux/freezer.h> #include <linux/pfn_t.h>
@@ -449,14 +450,6 @@ static void thpsize_release(struct kobjestatic DEFINE_SPINLOCK (huge_anon_orders_lock);static LIST_HEAD (thpsize_list); -struct thpsize { -struct kobject kobj; -struct list_head node; -int order; -}; - -#define to_thpsize (kobj) container_of(kobj, struct thpsize, kobj) -static ssize_t thpsize_enabled_show (struct kobject *kobj,struct kobj_attribute *attr,char *buf) {
@@ -517,6 +510,9 @@ static struct kobj_attribute thpsize_enastatic struct attribute *thpsize_attrs[] = { &thpsize_enabled_attr.attr, +#ifdef CONFIG_SHMEM + &thpsize_shmem_enabled_attr.attr, +#endifNULL , };
mm/shmem.c renamed from mm/shmem.c~mm-shmem-add-multi-size-thp-sysfs-interface-for-anonymous-shmem +96 -0
120 lines not on this page · raw message
_
Patches currently in -mm which might be from [email protected] are