mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Wang Long <w@laoqinren.net>
Cc: mingo@redhat.com, juri.lelli@redhat.com,
	vincent.guittot@linaro.org, dietmar.eggemann@arm.com,
	rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de,
	linux-kernel@vger.kernel.org, hannes@cmpxchg.org
Subject: Re: [PATCH] sched/psi: create /proc/pressure and /proc/pressure/{io|memory|cpu} only when psi enabled
Date: Wed, 8 Jan 2020 14:55:26 +0100	[thread overview]
Message-ID: <20200108135526.GH2844@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <1576672698-32504-1-git-send-email-w@laoqinren.net>

On Wed, Dec 18, 2019 at 08:38:18PM +0800, Wang Long wrote:
> 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.

Works for me; Johannes?

> Signed-off-by: Wang Long <w@laoqinren.net>
> ---
>  kernel/sched/psi.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/kernel/sched/psi.c b/kernel/sched/psi.c
> index 517e371..f12ade2 100644
> --- a/kernel/sched/psi.c
> +++ b/kernel/sched/psi.c
> @@ -1279,10 +1279,12 @@ static int psi_fop_release(struct inode *inode, struct file *file)
>  
>  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);
> -- 
> 1.8.3.1
> 
> 
> 

  reply	other threads:[~2020-01-08 13:55 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-18 12:38 Wang Long
2020-01-08 13:55 ` Peter Zijlstra [this message]
2020-01-09 15:30   ` Johannes Weiner
2020-01-10 13:55     ` Peter Zijlstra
2020-01-17 10:08 ` [tip: sched/core] " tip-bot2 for Wang Long

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200108135526.GH2844@hirez.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=bsegall@google.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=hannes@cmpxchg.org \
    --cc=juri.lelli@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=rostedt@goodmis.org \
    --cc=vincent.guittot@linaro.org \
    --cc=w@laoqinren.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®