~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/tools/testing/selftests/mm/thp_settings.h

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0 */
  2 #ifndef __THP_SETTINGS_H__
  3 #define __THP_SETTINGS_H__
  4 
  5 #include <stdbool.h>
  6 #include <stddef.h>
  7 #include <stdint.h>
  8 
  9 enum thp_enabled {
 10         THP_NEVER,
 11         THP_ALWAYS,
 12         THP_INHERIT,
 13         THP_MADVISE,
 14 };
 15 
 16 enum thp_defrag {
 17         THP_DEFRAG_ALWAYS,
 18         THP_DEFRAG_DEFER,
 19         THP_DEFRAG_DEFER_MADVISE,
 20         THP_DEFRAG_MADVISE,
 21         THP_DEFRAG_NEVER,
 22 };
 23 
 24 enum shmem_enabled {
 25         SHMEM_NEVER,
 26         SHMEM_ALWAYS,
 27         SHMEM_WITHIN_SIZE,
 28         SHMEM_ADVISE,
 29         SHMEM_INHERIT,
 30         SHMEM_DENY,
 31         SHMEM_FORCE,
 32 };
 33 
 34 #define NR_ORDERS 20
 35 
 36 struct hugepages_settings {
 37         enum thp_enabled enabled;
 38 };
 39 
 40 struct khugepaged_settings {
 41         bool defrag;
 42         unsigned int alloc_sleep_millisecs;
 43         unsigned int scan_sleep_millisecs;
 44         unsigned int max_ptes_none;
 45         unsigned int max_ptes_swap;
 46         unsigned int max_ptes_shared;
 47         unsigned long pages_to_scan;
 48 };
 49 
 50 struct shmem_hugepages_settings {
 51         enum shmem_enabled enabled;
 52 };
 53 
 54 struct thp_settings {
 55         enum thp_enabled thp_enabled;
 56         enum thp_defrag thp_defrag;
 57         enum shmem_enabled shmem_enabled;
 58         bool use_zero_page;
 59         struct khugepaged_settings khugepaged;
 60         unsigned long read_ahead_kb;
 61         struct hugepages_settings hugepages[NR_ORDERS];
 62         struct shmem_hugepages_settings shmem_hugepages[NR_ORDERS];
 63 };
 64 
 65 int read_file(const char *path, char *buf, size_t buflen);
 66 int write_file(const char *path, const char *buf, size_t buflen);
 67 const unsigned long read_num(const char *path);
 68 void write_num(const char *path, unsigned long num);
 69 
 70 int thp_read_string(const char *name, const char * const strings[]);
 71 void thp_write_string(const char *name, const char *val);
 72 const unsigned long thp_read_num(const char *name);
 73 void thp_write_num(const char *name, unsigned long num);
 74 
 75 void thp_write_settings(struct thp_settings *settings);
 76 void thp_read_settings(struct thp_settings *settings);
 77 struct thp_settings *thp_current_settings(void);
 78 void thp_push_settings(struct thp_settings *settings);
 79 void thp_pop_settings(void);
 80 void thp_restore_settings(void);
 81 void thp_save_settings(void);
 82 
 83 void thp_set_read_ahead_path(char *path);
 84 unsigned long thp_supported_orders(void);
 85 unsigned long thp_shmem_supported_orders(void);
 86 
 87 #endif /* __THP_SETTINGS_H__ */
 88 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php