Skip to content

Commit

Permalink
sched/psi: create /proc/pressure and /proc/pressure/{io|memory|cpu} o…
Browse files Browse the repository at this point in the history
…nly when psi enabled

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: Wang Long <w@laoqinren.net>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Link: https://lkml.kernel.org/r/1576672698-32504-1-git-send-email-w@laoqinren.net
  • Loading branch information
Wang Long authored and Peter Zijlstra committed Jan 17, 2020
1 parent 4c58f57 commit 3d81768
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions kernel/sched/psi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1280,10 +1280,12 @@ static const struct file_operations psi_cpu_fops = {

static int __init psi_proc_init(void)
{
proc_mkdir("pressure", NULL);
proc_create("pressure/io", 0, NULL, &psi_io_fops);
proc_create("pressure/memory", 0, NULL, &psi_memory_fops);
proc_create("pressure/cpu", 0, NULL, &psi_cpu_fops);
if (psi_enable) {
proc_mkdir("pressure", NULL);
proc_create("pressure/io", 0, NULL, &psi_io_fops);
proc_create("pressure/memory", 0, NULL, &psi_memory_fops);
proc_create("pressure/cpu", 0, NULL, &psi_cpu_fops);
}
return 0;
}
module_init(psi_proc_init);

0 comments on commit 3d81768

Please sign in to comment.