提交 9e58d704 编写于 作者: X Xu Yu

alinux: mm, memcg: add kconfig MEMSLI

to #26424368

This introduces the new bool kconfig MEMSLI, determining whether the
memsli (memory latency histogram) feature should be built-in or not.
Signed-off-by: NXu Yu <xuyu@linux.alibaba.com>
Reviewed-by: NYang Shi <yang.shi@linux.alibaba.com>
Reviewed-by: NXunlei Pang <xlpang@linux.alibaba.com>
上级 892970b7
...@@ -935,10 +935,6 @@ static inline bool is_wmark_ok(struct mem_cgroup *memcg, bool high) ...@@ -935,10 +935,6 @@ static inline bool is_wmark_ok(struct mem_cgroup *memcg, bool high)
int memcg_get_wmark_min_adj(struct task_struct *curr); int memcg_get_wmark_min_adj(struct task_struct *curr);
void memcg_check_wmark_min_adj(struct task_struct *curr, void memcg_check_wmark_min_adj(struct task_struct *curr,
struct alloc_context *ac); struct alloc_context *ac);
extern void memcg_lat_stat_update(enum mem_lat_stat_item sidx, u64 duration);
extern void memcg_lat_stat_start(u64 *start);
extern u64 memcg_lat_stat_end(u64 start);
#else /* CONFIG_MEMCG */ #else /* CONFIG_MEMCG */
#define MEM_CGROUP_ID_SHIFT 0 #define MEM_CGROUP_ID_SHIFT 0
...@@ -1289,7 +1285,13 @@ static inline void memcg_check_wmark_min_adj(struct task_struct *curr, ...@@ -1289,7 +1285,13 @@ static inline void memcg_check_wmark_min_adj(struct task_struct *curr,
struct alloc_context *ac) struct alloc_context *ac)
{ {
} }
#endif /* CONFIG_MEMCG */
#ifdef CONFIG_MEMSLI
extern void memcg_lat_stat_update(enum mem_lat_stat_item sidx, u64 duration);
extern void memcg_lat_stat_start(u64 *start);
extern u64 memcg_lat_stat_end(u64 start);
#else
static inline void memcg_lat_stat_update(enum mem_lat_stat_item sidx, static inline void memcg_lat_stat_update(enum mem_lat_stat_item sidx,
u64 duration) u64 duration)
{ {
...@@ -1303,7 +1305,7 @@ static inline u64 memcg_lat_stat_end(u64 start) ...@@ -1303,7 +1305,7 @@ static inline u64 memcg_lat_stat_end(u64 start)
{ {
return 0; return 0;
} }
#endif /* CONFIG_MEMCG */ #endif /* CONFIG_MEMSLI */
/* idx can be of type enum memcg_stat_item or node_stat_item */ /* idx can be of type enum memcg_stat_item or node_stat_item */
static inline void __inc_memcg_state(struct mem_cgroup *memcg, static inline void __inc_memcg_state(struct mem_cgroup *memcg,
......
...@@ -786,4 +786,13 @@ config KIDLED ...@@ -786,4 +786,13 @@ config KIDLED
See Documentation/vm/kidled.rst for more details. See Documentation/vm/kidled.rst for more details.
config MEMSLI
bool "Support memory latency histogram, a.k.a, memsli"
depends on MEMCG
default Y
help
This probes and calculates various kinds of memory latency, and then
groups into the corresponding latency histogram in every memory
cgroup, respectively.
endmenu endmenu
...@@ -4523,6 +4523,7 @@ void memcg_check_wmark_min_adj(struct task_struct *curr, ...@@ -4523,6 +4523,7 @@ void memcg_check_wmark_min_adj(struct task_struct *curr,
} }
} }
#ifdef CONFIG_MEMSLI
#define MEMCG_LAT_STAT_SMP_WRITE(name, sidx) \ #define MEMCG_LAT_STAT_SMP_WRITE(name, sidx) \
static void smp_write_##name(void *info) \ static void smp_write_##name(void *info) \
{ \ { \
...@@ -4663,6 +4664,7 @@ u64 memcg_lat_stat_end(u64 start) ...@@ -4663,6 +4664,7 @@ u64 memcg_lat_stat_end(u64 start)
else else
return 0; return 0;
} }
#endif /* CONFIG_MEMSLI */
static void __mem_cgroup_threshold(struct mem_cgroup *memcg, bool swap) static void __mem_cgroup_threshold(struct mem_cgroup *memcg, bool swap)
{ {
...@@ -5563,6 +5565,7 @@ static struct cftype mem_cgroup_legacy_files[] = { ...@@ -5563,6 +5565,7 @@ static struct cftype mem_cgroup_legacy_files[] = {
.seq_show = memory_wmark_min_adj_show, .seq_show = memory_wmark_min_adj_show,
.write = memory_wmark_min_adj_write, .write = memory_wmark_min_adj_write,
}, },
#ifdef CONFIG_MEMSLI
{ {
.name = "direct_reclaim_global_latency", .name = "direct_reclaim_global_latency",
.private = MEM_LAT_GLOBAL_DIRECT_RECLAIM, .private = MEM_LAT_GLOBAL_DIRECT_RECLAIM,
...@@ -5599,6 +5602,7 @@ static struct cftype mem_cgroup_legacy_files[] = { ...@@ -5599,6 +5602,7 @@ static struct cftype mem_cgroup_legacy_files[] = {
.write_u64 = memcg_lat_stat_write, .write_u64 = memcg_lat_stat_write,
.seq_show = memcg_lat_stat_show, .seq_show = memcg_lat_stat_show,
}, },
#endif /* CONFIG_MEMSLI */
{ {
.name = "force_empty", .name = "force_empty",
.write = mem_cgroup_force_empty_write, .write = mem_cgroup_force_empty_write,
...@@ -7777,6 +7781,7 @@ static int __init enable_cgroup_writeback_v1(char *s) ...@@ -7777,6 +7781,7 @@ static int __init enable_cgroup_writeback_v1(char *s)
__setup("cgwb_v1", enable_cgroup_writeback_v1); __setup("cgwb_v1", enable_cgroup_writeback_v1);
#endif #endif
#ifdef CONFIG_MEMSLI
static int memsli_enabled_show(struct seq_file *m, void *v) static int memsli_enabled_show(struct seq_file *m, void *v)
{ {
seq_printf(m, "%d\n", !static_key_enabled(&cgroup_memory_nosli)); seq_printf(m, "%d\n", !static_key_enabled(&cgroup_memory_nosli));
...@@ -7826,6 +7831,7 @@ static const struct file_operations memsli_enabled_fops = { ...@@ -7826,6 +7831,7 @@ static const struct file_operations memsli_enabled_fops = {
.llseek = seq_lseek, .llseek = seq_lseek,
.release = single_release, .release = single_release,
}; };
#endif /* CONFIG_MEMSLI */
/* /*
* subsys_initcall() for memory controller. * subsys_initcall() for memory controller.
...@@ -7847,6 +7853,7 @@ static int __init mem_cgroup_init(void) ...@@ -7847,6 +7853,7 @@ static int __init mem_cgroup_init(void)
if (!memcg_wmark_wq) if (!memcg_wmark_wq)
return -ENOMEM; return -ENOMEM;
#ifdef CONFIG_MEMSLI
memsli_dir = proc_mkdir("memsli", NULL); memsli_dir = proc_mkdir("memsli", NULL);
if (!memsli_dir) if (!memsli_dir)
return -ENOMEM; return -ENOMEM;
...@@ -7857,6 +7864,7 @@ static int __init mem_cgroup_init(void) ...@@ -7857,6 +7864,7 @@ static int __init mem_cgroup_init(void)
remove_proc_entry("memsli", NULL); remove_proc_entry("memsli", NULL);
return -ENOMEM; return -ENOMEM;
} }
#endif /* CONFIG_MEMSLI */
#ifdef CONFIG_MEMCG_KMEM #ifdef CONFIG_MEMCG_KMEM
/* /*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册