All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Fix warnings in psi
@ 2022-01-19 22:39 Suren Baghdasaryan
  2022-01-19 22:39 ` [PATCH 1/2] psi: Fix "no previous prototype" warnings when CONFIG_CGROUPS=n Suren Baghdasaryan
  2022-01-19 22:39 ` [PATCH 2/2] psi: Fix "defined but not used" warnings when CONFIG_PROC_FS=n Suren Baghdasaryan
  0 siblings, 2 replies; 7+ messages in thread
From: Suren Baghdasaryan @ 2022-01-19 22:39 UTC (permalink / raw)
  To: hannes
  Cc: peterz, mingo, ebiggers, tj, willy, juri.lelli, vincent.guittot,
	dietmar.eggemann, rostedt, bsegall, mgorman, bristot, akpm,
	linux-kernel, kernel-team, surenb

The patchset fixes warnings in the psi module visible only in the below
configurations:
CONFIG_PSI=y && CONFIG_CGROUPS=n
CONFIG_PSI=y && CONFIG_PROC_FS=n
Reproduced using clang version 14.0.0.

The patches are based on sched/urgent branch:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git sched/urgent

Suren Baghdasaryan (2):
  psi: Fix "no previous prototype" warnings when CONFIG_CGROUPS=n
  psi: Fix "defined but not used" warnings when CONFIG_PROC_FS=n

 include/linux/psi.h | 11 +++----
 kernel/sched/psi.c  | 79 +++++++++++++++++++++++----------------------
 2 files changed, 46 insertions(+), 44 deletions(-)

-- 
2.34.1.703.g22d0c6ccf7-goog


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

* [PATCH 1/2] psi: Fix "no previous prototype" warnings when CONFIG_CGROUPS=n
  2022-01-19 22:39 [PATCH 0/2] Fix warnings in psi Suren Baghdasaryan
@ 2022-01-19 22:39 ` Suren Baghdasaryan
  2022-01-20 15:53   ` Johannes Weiner
  2022-01-28  7:40   ` [tip: sched/core] " tip-bot2 for Suren Baghdasaryan
  2022-01-19 22:39 ` [PATCH 2/2] psi: Fix "defined but not used" warnings when CONFIG_PROC_FS=n Suren Baghdasaryan
  1 sibling, 2 replies; 7+ messages in thread
From: Suren Baghdasaryan @ 2022-01-19 22:39 UTC (permalink / raw)
  To: hannes
  Cc: peterz, mingo, ebiggers, tj, willy, juri.lelli, vincent.guittot,
	dietmar.eggemann, rostedt, bsegall, mgorman, bristot, akpm,
	linux-kernel, kernel-team, surenb, kernel test robot

When CONFIG_CGROUPS is disabled psi code generates the following warnings:

kernel/sched/psi.c:1112:21: warning: no previous prototype for 'psi_trigger_create' [-Wmissing-prototypes]
    1112 | struct psi_trigger *psi_trigger_create(struct psi_group *group,
         |                     ^~~~~~~~~~~~~~~~~~
kernel/sched/psi.c:1182:6: warning: no previous prototype for 'psi_trigger_destroy' [-Wmissing-prototypes]
    1182 | void psi_trigger_destroy(struct psi_trigger *t)
         |      ^~~~~~~~~~~~~~~~~~~
kernel/sched/psi.c:1249:10: warning: no previous prototype for 'psi_trigger_poll' [-Wmissing-prototypes]
    1249 | __poll_t psi_trigger_poll(void **trigger_ptr,
         |          ^~~~~~~~~~~~~~~~

Change declarations of these functions in the header to provide the
prototypes even when they are unused.

Fixes: 0e94682b73bf ("psi: introduce psi monitor")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
---
 include/linux/psi.h | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/include/linux/psi.h b/include/linux/psi.h
index f8ce53bfdb2a..7f7d1d88c3bb 100644
--- a/include/linux/psi.h
+++ b/include/linux/psi.h
@@ -25,18 +25,17 @@ void psi_memstall_enter(unsigned long *flags);
 void psi_memstall_leave(unsigned long *flags);
 
 int psi_show(struct seq_file *s, struct psi_group *group, enum psi_res res);
-
-#ifdef CONFIG_CGROUPS
-int psi_cgroup_alloc(struct cgroup *cgrp);
-void psi_cgroup_free(struct cgroup *cgrp);
-void cgroup_move_task(struct task_struct *p, struct css_set *to);
-
 struct psi_trigger *psi_trigger_create(struct psi_group *group,
 			char *buf, size_t nbytes, enum psi_res res);
 void psi_trigger_destroy(struct psi_trigger *t);
 
 __poll_t psi_trigger_poll(void **trigger_ptr, struct file *file,
 			poll_table *wait);
+
+#ifdef CONFIG_CGROUPS
+int psi_cgroup_alloc(struct cgroup *cgrp);
+void psi_cgroup_free(struct cgroup *cgrp);
+void cgroup_move_task(struct task_struct *p, struct css_set *to);
 #endif
 
 #else /* CONFIG_PSI */
-- 
2.34.1.703.g22d0c6ccf7-goog


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

* [PATCH 2/2] psi: Fix "defined but not used" warnings when CONFIG_PROC_FS=n
  2022-01-19 22:39 [PATCH 0/2] Fix warnings in psi Suren Baghdasaryan
  2022-01-19 22:39 ` [PATCH 1/2] psi: Fix "no previous prototype" warnings when CONFIG_CGROUPS=n Suren Baghdasaryan
@ 2022-01-19 22:39 ` Suren Baghdasaryan
  2022-01-20 15:54   ` Johannes Weiner
  2022-01-28  7:40   ` [tip: sched/core] " tip-bot2 for Suren Baghdasaryan
  1 sibling, 2 replies; 7+ messages in thread
From: Suren Baghdasaryan @ 2022-01-19 22:39 UTC (permalink / raw)
  To: hannes
  Cc: peterz, mingo, ebiggers, tj, willy, juri.lelli, vincent.guittot,
	dietmar.eggemann, rostedt, bsegall, mgorman, bristot, akpm,
	linux-kernel, kernel-team, surenb, kernel test robot

When CONFIG_PROC_FS is disabled psi code generates the following warnings:

kernel/sched/psi.c:1364:30: warning: 'psi_cpu_proc_ops' defined but not used [-Wunused-const-variable=]
    1364 | static const struct proc_ops psi_cpu_proc_ops = {
         |                              ^~~~~~~~~~~~~~~~
kernel/sched/psi.c:1355:30: warning: 'psi_memory_proc_ops' defined but not used [-Wunused-const-variable=]
    1355 | static const struct proc_ops psi_memory_proc_ops = {
         |                              ^~~~~~~~~~~~~~~~~~~
kernel/sched/psi.c:1346:30: warning: 'psi_io_proc_ops' defined but not used [-Wunused-const-variable=]
    1346 | static const struct proc_ops psi_io_proc_ops = {
         |                              ^~~~~~~~~~~~~~~

Make definitions of these structures and related functions conditional on
CONFIG_PROC_FS config.

Fixes: 0e94682b73bf ("psi: introduce psi monitor")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
---
 kernel/sched/psi.c | 79 ++++++++++++++++++++++++----------------------
 1 file changed, 41 insertions(+), 38 deletions(-)

diff --git a/kernel/sched/psi.c b/kernel/sched/psi.c
index c137c4d6983e..e14358178849 100644
--- a/kernel/sched/psi.c
+++ b/kernel/sched/psi.c
@@ -1082,44 +1082,6 @@ int psi_show(struct seq_file *m, struct psi_group *group, enum psi_res res)
 	return 0;
 }
 
-static int psi_io_show(struct seq_file *m, void *v)
-{
-	return psi_show(m, &psi_system, PSI_IO);
-}
-
-static int psi_memory_show(struct seq_file *m, void *v)
-{
-	return psi_show(m, &psi_system, PSI_MEM);
-}
-
-static int psi_cpu_show(struct seq_file *m, void *v)
-{
-	return psi_show(m, &psi_system, PSI_CPU);
-}
-
-static int psi_open(struct file *file, int (*psi_show)(struct seq_file *, void *))
-{
-	if (file->f_mode & FMODE_WRITE && !capable(CAP_SYS_RESOURCE))
-		return -EPERM;
-
-	return single_open(file, psi_show, NULL);
-}
-
-static int psi_io_open(struct inode *inode, struct file *file)
-{
-	return psi_open(file, psi_io_show);
-}
-
-static int psi_memory_open(struct inode *inode, struct file *file)
-{
-	return psi_open(file, psi_memory_show);
-}
-
-static int psi_cpu_open(struct inode *inode, struct file *file)
-{
-	return psi_open(file, psi_cpu_show);
-}
-
 struct psi_trigger *psi_trigger_create(struct psi_group *group,
 			char *buf, size_t nbytes, enum psi_res res)
 {
@@ -1278,6 +1240,45 @@ __poll_t psi_trigger_poll(void **trigger_ptr,
 	return ret;
 }
 
+#ifdef CONFIG_PROC_FS
+static int psi_io_show(struct seq_file *m, void *v)
+{
+	return psi_show(m, &psi_system, PSI_IO);
+}
+
+static int psi_memory_show(struct seq_file *m, void *v)
+{
+	return psi_show(m, &psi_system, PSI_MEM);
+}
+
+static int psi_cpu_show(struct seq_file *m, void *v)
+{
+	return psi_show(m, &psi_system, PSI_CPU);
+}
+
+static int psi_open(struct file *file, int (*psi_show)(struct seq_file *, void *))
+{
+	if (file->f_mode & FMODE_WRITE && !capable(CAP_SYS_RESOURCE))
+		return -EPERM;
+
+	return single_open(file, psi_show, NULL);
+}
+
+static int psi_io_open(struct inode *inode, struct file *file)
+{
+	return psi_open(file, psi_io_show);
+}
+
+static int psi_memory_open(struct inode *inode, struct file *file)
+{
+	return psi_open(file, psi_memory_show);
+}
+
+static int psi_cpu_open(struct inode *inode, struct file *file)
+{
+	return psi_open(file, psi_cpu_show);
+}
+
 static ssize_t psi_write(struct file *file, const char __user *user_buf,
 			 size_t nbytes, enum psi_res res)
 {
@@ -1392,3 +1393,5 @@ static int __init psi_proc_init(void)
 	return 0;
 }
 module_init(psi_proc_init);
+
+#endif /* CONFIG_PROC_FS */
-- 
2.34.1.703.g22d0c6ccf7-goog


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

* Re: [PATCH 1/2] psi: Fix "no previous prototype" warnings when CONFIG_CGROUPS=n
  2022-01-19 22:39 ` [PATCH 1/2] psi: Fix "no previous prototype" warnings when CONFIG_CGROUPS=n Suren Baghdasaryan
@ 2022-01-20 15:53   ` Johannes Weiner
  2022-01-28  7:40   ` [tip: sched/core] " tip-bot2 for Suren Baghdasaryan
  1 sibling, 0 replies; 7+ messages in thread
From: Johannes Weiner @ 2022-01-20 15:53 UTC (permalink / raw)
  To: Suren Baghdasaryan
  Cc: peterz, mingo, ebiggers, tj, willy, juri.lelli, vincent.guittot,
	dietmar.eggemann, rostedt, bsegall, mgorman, bristot, akpm,
	linux-kernel, kernel-team, kernel test robot

On Wed, Jan 19, 2022 at 02:39:39PM -0800, Suren Baghdasaryan wrote:
> When CONFIG_CGROUPS is disabled psi code generates the following warnings:
> 
> kernel/sched/psi.c:1112:21: warning: no previous prototype for 'psi_trigger_create' [-Wmissing-prototypes]
>     1112 | struct psi_trigger *psi_trigger_create(struct psi_group *group,
>          |                     ^~~~~~~~~~~~~~~~~~
> kernel/sched/psi.c:1182:6: warning: no previous prototype for 'psi_trigger_destroy' [-Wmissing-prototypes]
>     1182 | void psi_trigger_destroy(struct psi_trigger *t)
>          |      ^~~~~~~~~~~~~~~~~~~
> kernel/sched/psi.c:1249:10: warning: no previous prototype for 'psi_trigger_poll' [-Wmissing-prototypes]
>     1249 | __poll_t psi_trigger_poll(void **trigger_ptr,
>          |          ^~~~~~~~~~~~~~~~
> 
> Change declarations of these functions in the header to provide the
> prototypes even when they are unused.
>
> Fixes: 0e94682b73bf ("psi: introduce psi monitor")
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Suren Baghdasaryan <surenb@google.com>

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

For a second I was confused by the "unused" in the changelog. The
functions themselves are used unconditionally: by the internal
/proc/pressure/* implementation. But I suppose that usage wouldn't
need the prototypes - hence unused prototypes.

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

* Re: [PATCH 2/2] psi: Fix "defined but not used" warnings when CONFIG_PROC_FS=n
  2022-01-19 22:39 ` [PATCH 2/2] psi: Fix "defined but not used" warnings when CONFIG_PROC_FS=n Suren Baghdasaryan
@ 2022-01-20 15:54   ` Johannes Weiner
  2022-01-28  7:40   ` [tip: sched/core] " tip-bot2 for Suren Baghdasaryan
  1 sibling, 0 replies; 7+ messages in thread
From: Johannes Weiner @ 2022-01-20 15:54 UTC (permalink / raw)
  To: Suren Baghdasaryan
  Cc: peterz, mingo, ebiggers, tj, willy, juri.lelli, vincent.guittot,
	dietmar.eggemann, rostedt, bsegall, mgorman, bristot, akpm,
	linux-kernel, kernel-team, kernel test robot

On Wed, Jan 19, 2022 at 02:39:40PM -0800, Suren Baghdasaryan wrote:
> When CONFIG_PROC_FS is disabled psi code generates the following warnings:
> 
> kernel/sched/psi.c:1364:30: warning: 'psi_cpu_proc_ops' defined but not used [-Wunused-const-variable=]
>     1364 | static const struct proc_ops psi_cpu_proc_ops = {
>          |                              ^~~~~~~~~~~~~~~~
> kernel/sched/psi.c:1355:30: warning: 'psi_memory_proc_ops' defined but not used [-Wunused-const-variable=]
>     1355 | static const struct proc_ops psi_memory_proc_ops = {
>          |                              ^~~~~~~~~~~~~~~~~~~
> kernel/sched/psi.c:1346:30: warning: 'psi_io_proc_ops' defined but not used [-Wunused-const-variable=]
>     1346 | static const struct proc_ops psi_io_proc_ops = {
>          |                              ^~~~~~~~~~~~~~~
> 
> Make definitions of these structures and related functions conditional on
> CONFIG_PROC_FS config.
> 
> Fixes: 0e94682b73bf ("psi: introduce psi monitor")
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Suren Baghdasaryan <surenb@google.com>

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

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

* [tip: sched/core] psi: Fix "no previous prototype" warnings when CONFIG_CGROUPS=n
  2022-01-19 22:39 ` [PATCH 1/2] psi: Fix "no previous prototype" warnings when CONFIG_CGROUPS=n Suren Baghdasaryan
  2022-01-20 15:53   ` Johannes Weiner
@ 2022-01-28  7:40   ` tip-bot2 for Suren Baghdasaryan
  1 sibling, 0 replies; 7+ messages in thread
From: tip-bot2 for Suren Baghdasaryan @ 2022-01-28  7:40 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: kernel test robot, Suren Baghdasaryan, Peter Zijlstra (Intel),
	x86, linux-kernel

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

Commit-ID:     ec2444530612a886b406e2830d7f314d1a07d4bb
Gitweb:        https://git.kernel.org/tip/ec2444530612a886b406e2830d7f314d1a07d4bb
Author:        Suren Baghdasaryan <surenb@google.com>
AuthorDate:    Wed, 19 Jan 2022 14:39:39 -08:00
Committer:     Peter Zijlstra <peterz@infradead.org>
CommitterDate: Thu, 27 Jan 2022 12:57:19 +01:00

psi: Fix "no previous prototype" warnings when CONFIG_CGROUPS=n

When CONFIG_CGROUPS is disabled psi code generates the following warnings:

kernel/sched/psi.c:1112:21: warning: no previous prototype for 'psi_trigger_create' [-Wmissing-prototypes]
    1112 | struct psi_trigger *psi_trigger_create(struct psi_group *group,
         |                     ^~~~~~~~~~~~~~~~~~
kernel/sched/psi.c:1182:6: warning: no previous prototype for 'psi_trigger_destroy' [-Wmissing-prototypes]
    1182 | void psi_trigger_destroy(struct psi_trigger *t)
         |      ^~~~~~~~~~~~~~~~~~~
kernel/sched/psi.c:1249:10: warning: no previous prototype for 'psi_trigger_poll' [-Wmissing-prototypes]
    1249 | __poll_t psi_trigger_poll(void **trigger_ptr,
         |          ^~~~~~~~~~~~~~~~

Change declarations of these functions in the header to provide the
prototypes even when they are unused.

Fixes: 0e94682b73bf ("psi: introduce psi monitor")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20220119223940.787748-2-surenb@google.com
---
 include/linux/psi.h | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/include/linux/psi.h b/include/linux/psi.h
index a70ca83..8279702 100644
--- a/include/linux/psi.h
+++ b/include/linux/psi.h
@@ -25,18 +25,17 @@ void psi_memstall_enter(unsigned long *flags);
 void psi_memstall_leave(unsigned long *flags);
 
 int psi_show(struct seq_file *s, struct psi_group *group, enum psi_res res);
-
-#ifdef CONFIG_CGROUPS
-int psi_cgroup_alloc(struct cgroup *cgrp);
-void psi_cgroup_free(struct cgroup *cgrp);
-void cgroup_move_task(struct task_struct *p, struct css_set *to);
-
 struct psi_trigger *psi_trigger_create(struct psi_group *group,
 			char *buf, size_t nbytes, enum psi_res res);
 void psi_trigger_replace(void **trigger_ptr, struct psi_trigger *t);
 
 __poll_t psi_trigger_poll(void **trigger_ptr, struct file *file,
 			poll_table *wait);
+
+#ifdef CONFIG_CGROUPS
+int psi_cgroup_alloc(struct cgroup *cgrp);
+void psi_cgroup_free(struct cgroup *cgrp);
+void cgroup_move_task(struct task_struct *p, struct css_set *to);
 #endif
 
 #else /* CONFIG_PSI */

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

* [tip: sched/core] psi: Fix "defined but not used" warnings when CONFIG_PROC_FS=n
  2022-01-19 22:39 ` [PATCH 2/2] psi: Fix "defined but not used" warnings when CONFIG_PROC_FS=n Suren Baghdasaryan
  2022-01-20 15:54   ` Johannes Weiner
@ 2022-01-28  7:40   ` tip-bot2 for Suren Baghdasaryan
  1 sibling, 0 replies; 7+ messages in thread
From: tip-bot2 for Suren Baghdasaryan @ 2022-01-28  7:40 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: kernel test robot, Suren Baghdasaryan, Peter Zijlstra (Intel),
	x86, linux-kernel

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

Commit-ID:     5102bb1c9f82857a3164af9d7ab7ad628cb783ed
Gitweb:        https://git.kernel.org/tip/5102bb1c9f82857a3164af9d7ab7ad628cb783ed
Author:        Suren Baghdasaryan <surenb@google.com>
AuthorDate:    Wed, 19 Jan 2022 14:39:40 -08:00
Committer:     Peter Zijlstra <peterz@infradead.org>
CommitterDate: Thu, 27 Jan 2022 12:57:19 +01:00

psi: Fix "defined but not used" warnings when CONFIG_PROC_FS=n

When CONFIG_PROC_FS is disabled psi code generates the following warnings:

kernel/sched/psi.c:1364:30: warning: 'psi_cpu_proc_ops' defined but not used [-Wunused-const-variable=]
    1364 | static const struct proc_ops psi_cpu_proc_ops = {
         |                              ^~~~~~~~~~~~~~~~
kernel/sched/psi.c:1355:30: warning: 'psi_memory_proc_ops' defined but not used [-Wunused-const-variable=]
    1355 | static const struct proc_ops psi_memory_proc_ops = {
         |                              ^~~~~~~~~~~~~~~~~~~
kernel/sched/psi.c:1346:30: warning: 'psi_io_proc_ops' defined but not used [-Wunused-const-variable=]
    1346 | static const struct proc_ops psi_io_proc_ops = {
         |                              ^~~~~~~~~~~~~~~

Make definitions of these structures and related functions conditional on
CONFIG_PROC_FS config.

Fixes: 0e94682b73bf ("psi: introduce psi monitor")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20220119223940.787748-3-surenb@google.com
---
 kernel/sched/psi.c | 79 +++++++++++++++++++++++----------------------
 1 file changed, 41 insertions(+), 38 deletions(-)

diff --git a/kernel/sched/psi.c b/kernel/sched/psi.c
index a679613..cfe76f7 100644
--- a/kernel/sched/psi.c
+++ b/kernel/sched/psi.c
@@ -1082,44 +1082,6 @@ int psi_show(struct seq_file *m, struct psi_group *group, enum psi_res res)
 	return 0;
 }
 
-static int psi_io_show(struct seq_file *m, void *v)
-{
-	return psi_show(m, &psi_system, PSI_IO);
-}
-
-static int psi_memory_show(struct seq_file *m, void *v)
-{
-	return psi_show(m, &psi_system, PSI_MEM);
-}
-
-static int psi_cpu_show(struct seq_file *m, void *v)
-{
-	return psi_show(m, &psi_system, PSI_CPU);
-}
-
-static int psi_open(struct file *file, int (*psi_show)(struct seq_file *, void *))
-{
-	if (file->f_mode & FMODE_WRITE && !capable(CAP_SYS_RESOURCE))
-		return -EPERM;
-
-	return single_open(file, psi_show, NULL);
-}
-
-static int psi_io_open(struct inode *inode, struct file *file)
-{
-	return psi_open(file, psi_io_show);
-}
-
-static int psi_memory_open(struct inode *inode, struct file *file)
-{
-	return psi_open(file, psi_memory_show);
-}
-
-static int psi_cpu_open(struct inode *inode, struct file *file)
-{
-	return psi_open(file, psi_cpu_show);
-}
-
 struct psi_trigger *psi_trigger_create(struct psi_group *group,
 			char *buf, size_t nbytes, enum psi_res res)
 {
@@ -1296,6 +1258,45 @@ __poll_t psi_trigger_poll(void **trigger_ptr,
 	return ret;
 }
 
+#ifdef CONFIG_PROC_FS
+static int psi_io_show(struct seq_file *m, void *v)
+{
+	return psi_show(m, &psi_system, PSI_IO);
+}
+
+static int psi_memory_show(struct seq_file *m, void *v)
+{
+	return psi_show(m, &psi_system, PSI_MEM);
+}
+
+static int psi_cpu_show(struct seq_file *m, void *v)
+{
+	return psi_show(m, &psi_system, PSI_CPU);
+}
+
+static int psi_open(struct file *file, int (*psi_show)(struct seq_file *, void *))
+{
+	if (file->f_mode & FMODE_WRITE && !capable(CAP_SYS_RESOURCE))
+		return -EPERM;
+
+	return single_open(file, psi_show, NULL);
+}
+
+static int psi_io_open(struct inode *inode, struct file *file)
+{
+	return psi_open(file, psi_io_show);
+}
+
+static int psi_memory_open(struct inode *inode, struct file *file)
+{
+	return psi_open(file, psi_memory_show);
+}
+
+static int psi_cpu_open(struct inode *inode, struct file *file)
+{
+	return psi_open(file, psi_cpu_show);
+}
+
 static ssize_t psi_write(struct file *file, const char __user *user_buf,
 			 size_t nbytes, enum psi_res res)
 {
@@ -1400,3 +1401,5 @@ static int __init psi_proc_init(void)
 	return 0;
 }
 module_init(psi_proc_init);
+
+#endif /* CONFIG_PROC_FS */

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

end of thread, other threads:[~2022-01-28  7:40 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-19 22:39 [PATCH 0/2] Fix warnings in psi Suren Baghdasaryan
2022-01-19 22:39 ` [PATCH 1/2] psi: Fix "no previous prototype" warnings when CONFIG_CGROUPS=n Suren Baghdasaryan
2022-01-20 15:53   ` Johannes Weiner
2022-01-28  7:40   ` [tip: sched/core] " tip-bot2 for Suren Baghdasaryan
2022-01-19 22:39 ` [PATCH 2/2] psi: Fix "defined but not used" warnings when CONFIG_PROC_FS=n Suren Baghdasaryan
2022-01-20 15:54   ` Johannes Weiner
2022-01-28  7:40   ` [tip: sched/core] " tip-bot2 for Suren Baghdasaryan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.