linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] sched/psi: create /proc/pressure and /proc/pressure/{io|memory|cpu} only when psi enabled
@ 2019-12-18 12:38 Wang Long
  2020-01-08 13:55 ` Peter Zijlstra
  2020-01-17 10:08 ` [tip: sched/core] " tip-bot2 for Wang Long
  0 siblings, 2 replies; 5+ messages in thread
From: Wang Long @ 2019-12-18 12:38 UTC (permalink / raw)
  To: mingo, peterz, juri.lelli, vincent.guittot, dietmar.eggemann,
	rostedt, bsegall, mgorman
  Cc: linux-kernel, Wang Long

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>
---
 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




^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] sched/psi: create /proc/pressure and /proc/pressure/{io|memory|cpu} only when psi enabled
  2019-12-18 12:38 [PATCH] sched/psi: create /proc/pressure and /proc/pressure/{io|memory|cpu} only when psi enabled Wang Long
@ 2020-01-08 13:55 ` Peter Zijlstra
  2020-01-09 15:30   ` Johannes Weiner
  2020-01-17 10:08 ` [tip: sched/core] " tip-bot2 for Wang Long
  1 sibling, 1 reply; 5+ messages in thread
From: Peter Zijlstra @ 2020-01-08 13:55 UTC (permalink / raw)
  To: Wang Long
  Cc: mingo, juri.lelli, vincent.guittot, dietmar.eggemann, rostedt,
	bsegall, mgorman, linux-kernel, hannes

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
> 
> 
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] sched/psi: create /proc/pressure and /proc/pressure/{io|memory|cpu} only when psi enabled
  2020-01-08 13:55 ` Peter Zijlstra
@ 2020-01-09 15:30   ` Johannes Weiner
  2020-01-10 13:55     ` Peter Zijlstra
  0 siblings, 1 reply; 5+ messages in thread
From: Johannes Weiner @ 2020-01-09 15:30 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: Wang Long, mingo, juri.lelli, vincent.guittot, dietmar.eggemann,
	rostedt, bsegall, mgorman, linux-kernel

On Wed, Jan 08, 2020 at 02:55:26PM +0100, Peter Zijlstra wrote:
> 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?

Seems reasonable, and the patch looks good to me.

Acked-by: Johannes Weiner <hannes@cmpxchg.org>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] sched/psi: create /proc/pressure and /proc/pressure/{io|memory|cpu} only when psi enabled
  2020-01-09 15:30   ` Johannes Weiner
@ 2020-01-10 13:55     ` Peter Zijlstra
  0 siblings, 0 replies; 5+ messages in thread
From: Peter Zijlstra @ 2020-01-10 13:55 UTC (permalink / raw)
  To: Johannes Weiner
  Cc: Wang Long, mingo, juri.lelli, vincent.guittot, dietmar.eggemann,
	rostedt, bsegall, mgorman, linux-kernel

On Thu, Jan 09, 2020 at 10:30:02AM -0500, Johannes Weiner wrote:
> On Wed, Jan 08, 2020 at 02:55:26PM +0100, Peter Zijlstra wrote:
> > 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?
> 
> Seems reasonable, and the patch looks good to me.
> 
> Acked-by: Johannes Weiner <hannes@cmpxchg.org>

Thanks!

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [tip: sched/core] sched/psi: create /proc/pressure and /proc/pressure/{io|memory|cpu} only when psi enabled
  2019-12-18 12:38 [PATCH] sched/psi: create /proc/pressure and /proc/pressure/{io|memory|cpu} only when psi enabled Wang Long
  2020-01-08 13:55 ` Peter Zijlstra
@ 2020-01-17 10:08 ` tip-bot2 for Wang Long
  1 sibling, 0 replies; 5+ messages in thread
From: tip-bot2 for Wang Long @ 2020-01-17 10:08 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Wang Long, Peter Zijlstra (Intel), Johannes Weiner, x86, LKML

The following commit has been merged into the sched/core branch of tip:

Commit-ID:     3d817689a62cf71bbb290af18cd26cf9764f38fe
Gitweb:        https://git.kernel.org/tip/3d817689a62cf71bbb290af18cd26cf9764f38fe
Author:        Wang Long <w@laoqinren.net>
AuthorDate:    Wed, 18 Dec 2019 20:38:18 +08:00
Committer:     Peter Zijlstra <peterz@infradead.org>
CommitterDate: Fri, 17 Jan 2020 10:19:22 +01:00

sched/psi: create /proc/pressure and /proc/pressure/{io|memory|cpu} only 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
---
 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 ce8f674..db7b50b 100644
--- a/kernel/sched/psi.c
+++ b/kernel/sched/psi.c
@@ -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);

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-01-17 10:09 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-18 12:38 [PATCH] sched/psi: create /proc/pressure and /proc/pressure/{io|memory|cpu} only when psi enabled Wang Long
2020-01-08 13:55 ` Peter Zijlstra
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).