aboutsummaryrefslogtreecommitdiff
path: root/tools/testing/selftests/mm/thp_settings.h
diff options
context:
space:
mode:
authorGravatar Ryan Roberts <ryan.roberts@arm.com> 2023-12-07 16:12:08 +0000
committerGravatar Andrew Morton <akpm@linux-foundation.org> 2023-12-20 14:48:12 -0800
commit4f5070a5e40db2e9dbf5fff4ec678d6fbb338d5c (patch)
tree8ef9da5381f67646515f3828ada50cd12f123147 /tools/testing/selftests/mm/thp_settings.h
parentselftests/mm: factor out thp settings management (diff)
downloadlinux-4f5070a5e40db2e9dbf5fff4ec678d6fbb338d5c.tar.gz
linux-4f5070a5e40db2e9dbf5fff4ec678d6fbb338d5c.tar.bz2
linux-4f5070a5e40db2e9dbf5fff4ec678d6fbb338d5c.zip
selftests/mm: support multi-size THP interface in thp_settings
Save and restore the new per-size hugepage enabled setting, if available on the running kernel. Since the number of per-size directories is not fixed, solve this as simply as possible by catering for a maximum number in the thp_settings struct (20). Each array index is the order. The value of THP_NEVER is changed to 0 so that all of these new settings default to THP_NEVER and the user only needs to fill in the ones they want to enable. Link: https://lkml.kernel.org/r/20231207161211.2374093-8-ryan.roberts@arm.com Signed-off-by: Ryan Roberts <ryan.roberts@arm.com> Tested-by: Kefeng Wang <wangkefeng.wang@huawei.com> Tested-by: John Hubbard <jhubbard@nvidia.com> Cc: Alistair Popple <apopple@nvidia.com> Cc: Anshuman Khandual <anshuman.khandual@arm.com> Cc: Barry Song <v-songbaohua@oppo.com> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: David Hildenbrand <david@redhat.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>
Diffstat (limited to 'tools/testing/selftests/mm/thp_settings.h')
-rw-r--r--tools/testing/selftests/mm/thp_settings.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/tools/testing/selftests/mm/thp_settings.h b/tools/testing/selftests/mm/thp_settings.h
index ff3d98c30617..71cbff05f4c7 100644
--- a/tools/testing/selftests/mm/thp_settings.h
+++ b/tools/testing/selftests/mm/thp_settings.h
@@ -7,9 +7,10 @@
#include <stdint.h>
enum thp_enabled {
+ THP_NEVER,
THP_ALWAYS,
+ THP_INHERIT,
THP_MADVISE,
- THP_NEVER,
};
enum thp_defrag {
@@ -29,6 +30,12 @@ enum shmem_enabled {
SHMEM_FORCE,
};
+#define NR_ORDERS 20
+
+struct hugepages_settings {
+ enum thp_enabled enabled;
+};
+
struct khugepaged_settings {
bool defrag;
unsigned int alloc_sleep_millisecs;
@@ -46,6 +53,7 @@ struct thp_settings {
bool use_zero_page;
struct khugepaged_settings khugepaged;
unsigned long read_ahead_kb;
+ struct hugepages_settings hugepages[NR_ORDERS];
};
int read_file(const char *path, char *buf, size_t buflen);
@@ -67,5 +75,6 @@ void thp_restore_settings(void);
void thp_save_settings(void);
void thp_set_read_ahead_path(char *path);
+unsigned long thp_supported_orders(void);
#endif /* __THP_SETTINGS_H__ */