提交 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)
int memcg_get_wmark_min_adj(struct task_struct *curr);
void memcg_check_wmark_min_adj(struct task_struct *curr,
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 */
#define MEM_CGROUP_ID_SHIFT 0
......@@ -1289,7 +1285,13 @@ static inline void memcg_check_wmark_min_adj(struct task_struct *curr,
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,
u64 duration)
{
......@@ -1303,7 +1305,7 @@ static inline u64 memcg_lat_stat_end(u64 start)
{
return 0;
}
#endif /* CONFIG_MEMCG */
#endif /* CONFIG_MEMSLI */
/* idx can be of type enum memcg_stat_item or node_stat_item */
static inline void __inc_memcg_state(struct mem_cgroup *memcg,
......
......@@ -786,4 +786,13 @@ config KIDLED
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
......@@ -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) \
static void smp_write_##name(void *info) \
{ \
......@@ -4663,6 +4664,7 @@ u64 memcg_lat_stat_end(u64 start)
else
return 0;
}
#endif /* CONFIG_MEMSLI */
static void __mem_cgroup_threshold(struct mem_cgroup *memcg, bool swap)
{
......@@ -5563,6 +5565,7 @@ static struct cftype mem_cgroup_legacy_files[] = {
.seq_show = memory_wmark_min_adj_show,
.write = memory_wmark_min_adj_write,
},
#ifdef CONFIG_MEMSLI
{
.name = "direct_reclaim_global_latency",
.private = MEM_LAT_GLOBAL_DIRECT_RECLAIM,
......@@ -5599,6 +5602,7 @@ static struct cftype mem_cgroup_legacy_files[] = {
.write_u64 = memcg_lat_stat_write,
.seq_show = memcg_lat_stat_show,
},
#endif /* CONFIG_MEMSLI */
{
.name = "force_empty",
.write = mem_cgroup_force_empty_write,
......@@ -7777,6 +7781,7 @@ static int __init enable_cgroup_writeback_v1(char *s)
__setup("cgwb_v1", enable_cgroup_writeback_v1);
#endif
#ifdef CONFIG_MEMSLI
static int memsli_enabled_show(struct seq_file *m, void *v)
{
seq_printf(m, "%d\n", !static_key_enabled(&cgroup_memory_nosli));
......@@ -7826,6 +7831,7 @@ static const struct file_operations memsli_enabled_fops = {
.llseek = seq_lseek,
.release = single_release,
};
#endif /* CONFIG_MEMSLI */
/*
* subsys_initcall() for memory controller.
......@@ -7847,6 +7853,7 @@ static int __init mem_cgroup_init(void)
if (!memcg_wmark_wq)
return -ENOMEM;
#ifdef CONFIG_MEMSLI
memsli_dir = proc_mkdir("memsli", NULL);
if (!memsli_dir)
return -ENOMEM;
......@@ -7857,6 +7864,7 @@ static int __init mem_cgroup_init(void)
remove_proc_entry("memsli", NULL);
return -ENOMEM;
}
#endif /* CONFIG_MEMSLI */
#ifdef CONFIG_MEMCG_KMEM
/*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册