提交 f408f751 编写于 作者: W Wang Long 提交者: zhongjiang-ali

sched/psi: create /proc/pressure and /proc/pressure/{io|memory|cpu} only when psi enabled

task #28327019

commit 3d817689a62cf71bbb290af18cd26cf9764f38fe upstream

when CONFIG_PSI_DEFAULT_DISABLED set to N or the command line set psi=0,
I think we should not create /proc/pressure and
/proc/pressure/{io|memory|cpu}.

In the future, user maybe determine whether the psi feature is enabled by
checking the existence of the /proc/pressure dir or
/proc/pressure/{io|memory|cpu} files.
Signed-off-by: NWang Long <w@laoqinren.net>
Signed-off-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: NJohannes Weiner <hannes@cmpxchg.org>
Link: https://lkml.kernel.org/r/1576672698-32504-1-git-send-email-w@laoqinren.netSigned-off-by: Nzhongjiang-ali <zhongjiang-ali@linux.alibaba.com>
Reviewed-by: NXunlei Pang <xlpang@linux.alibaba.com>
上级 01a6f356
...@@ -1290,10 +1290,12 @@ static const struct file_operations psi_cpu_fops = { ...@@ -1290,10 +1290,12 @@ static const struct file_operations psi_cpu_fops = {
static int __init psi_proc_init(void) static int __init psi_proc_init(void)
{ {
proc_mkdir("pressure", NULL); if (psi_enable) {
proc_create("pressure/io", 0, NULL, &psi_io_fops); proc_mkdir("pressure", NULL);
proc_create("pressure/memory", 0, NULL, &psi_memory_fops); proc_create("pressure/io", 0, NULL, &psi_io_fops);
proc_create("pressure/cpu", 0, NULL, &psi_cpu_fops); proc_create("pressure/memory", 0, NULL, &psi_memory_fops);
proc_create("pressure/cpu", 0, NULL, &psi_cpu_fops);
}
return 0; return 0;
} }
module_init(psi_proc_init); module_init(psi_proc_init);
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册