2023-03-14 14:49:16

by Tom Rix

[permalink] [raw]
Subject: [PATCH] sched/topology: set varaiables sched_energy_mutex,update storage-class-specifier to static

smatch reports
kernel/sched/topology.c:212:1: warning:
symbol 'sched_energy_mutex' was not declared. Should it be static?
kernel/sched/topology.c:213:6: warning:
symbol 'sched_energy_update' was not declared. Should it be static?

These variables are only used in topology.c, so should be static

Signed-off-by: Tom Rix <[email protected]>
---
kernel/sched/topology.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c
index 051aaf65c749..6682535e37c8 100644
--- a/kernel/sched/topology.c
+++ b/kernel/sched/topology.c
@@ -209,8 +209,8 @@ sd_parent_degenerate(struct sched_domain *sd, struct sched_domain *parent)
#if defined(CONFIG_ENERGY_MODEL) && defined(CONFIG_CPU_FREQ_GOV_SCHEDUTIL)
DEFINE_STATIC_KEY_FALSE(sched_energy_present);
static unsigned int sysctl_sched_energy_aware = 1;
-DEFINE_MUTEX(sched_energy_mutex);
-bool sched_energy_update;
+static DEFINE_MUTEX(sched_energy_mutex);
+static bool sched_energy_update;

void rebuild_sched_domains_energy(void)
{
--
2.27.0



2023-03-15 16:22:16

by Valentin Schneider

[permalink] [raw]
Subject: Re: [PATCH] sched/topology: set varaiables sched_energy_mutex,update storage-class-specifier to static

On 14/03/23 10:48, Tom Rix wrote:
> smatch reports
> kernel/sched/topology.c:212:1: warning:
> symbol 'sched_energy_mutex' was not declared. Should it be static?
> kernel/sched/topology.c:213:6: warning:
> symbol 'sched_energy_update' was not declared. Should it be static?
>
> These variables are only used in topology.c, so should be static
>
> Signed-off-by: Tom Rix <[email protected]>

Reviewed-by: Valentin Schneider <[email protected]>


2023-03-20 10:41:57

by Peter Zijlstra

[permalink] [raw]
Subject: Re: [PATCH] sched/topology: set varaiables sched_energy_mutex,update storage-class-specifier to static

On Tue, Mar 14, 2023 at 10:48:18AM -0400, Tom Rix wrote:
> smatch reports
> kernel/sched/topology.c:212:1: warning:
> symbol 'sched_energy_mutex' was not declared. Should it be static?
> kernel/sched/topology.c:213:6: warning:
> symbol 'sched_energy_update' was not declared. Should it be static?
>
> These variables are only used in topology.c, so should be static
>
> Signed-off-by: Tom Rix <[email protected]>

Thanks!

Subject: [tip: sched/core] sched/topology: Make sched_energy_mutex,update static

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

Commit-ID: d91e15a21d4b3823ce93a42b05f0d171689f4e6a
Gitweb: https://git.kernel.org/tip/d91e15a21d4b3823ce93a42b05f0d171689f4e6a
Author: Tom Rix <[email protected]>
AuthorDate: Tue, 14 Mar 2023 10:48:18 -04:00
Committer: Peter Zijlstra <[email protected]>
CommitterDate: Wed, 22 Mar 2023 10:10:57 +01:00

sched/topology: Make sched_energy_mutex,update static

smatch reports
kernel/sched/topology.c:212:1: warning:
symbol 'sched_energy_mutex' was not declared. Should it be static?
kernel/sched/topology.c:213:6: warning:
symbol 'sched_energy_update' was not declared. Should it be static?

These variables are only used in topology.c, so should be static

Signed-off-by: Tom Rix <[email protected]>
Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
Reviewed-by: Valentin Schneider <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
---
kernel/sched/topology.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c
index 051aaf6..6682535 100644
--- a/kernel/sched/topology.c
+++ b/kernel/sched/topology.c
@@ -209,8 +209,8 @@ sd_parent_degenerate(struct sched_domain *sd, struct sched_domain *parent)
#if defined(CONFIG_ENERGY_MODEL) && defined(CONFIG_CPU_FREQ_GOV_SCHEDUTIL)
DEFINE_STATIC_KEY_FALSE(sched_energy_present);
static unsigned int sysctl_sched_energy_aware = 1;
-DEFINE_MUTEX(sched_energy_mutex);
-bool sched_energy_update;
+static DEFINE_MUTEX(sched_energy_mutex);
+static bool sched_energy_update;

void rebuild_sched_domains_energy(void)
{