Skip to contentSkip to conversation

sched/debug: remove obsolete init_schedstats()

PATCH Applied Eric Dumazet 5 participants 5 messages Jun 2, 2021 – Jun 4, 2021 Scheduler

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sched/debug: remove obsolete init_schedstats()

From: Eric Dumazet <[email protected]>

Revert "sched/debug: Fix 'schedstats=enable' cmdline option"

This reverts commit 4698f88c06b893f2acc0b443004a53bf490fde7c.

After commit 6041186a3258 ("init: initialize jump labels before command line option parsing") we can rely on jump label infra being ready for use when setup_schedstats() is called.

Cc Josh Poimboeuf <[email protected]>
Cc Peter Zijlstra (Intel) <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Dan Williams <[email protected]>
Cc Guenter Roeck <[email protected]>
Cc Kees Cook <[email protected]>
---
 kernel/sched/core.c | 19 ++-----------------
 1 file changed, 2 insertions(+), 17 deletions(-)
kernel/sched/core.c +2 -17
index 5226cc26a095f427dafa864ff37d39d529e2ba85..105fa6c73e7d9ded05683ee43a11e3b4461932d5 100644
@@ -3648,7 +3648,6 @@ int sysctl_numa_balancing(struct ctl_table *table, int write,
 #ifdef CONFIG_SCHEDSTATS
 
 DEFINE_STATIC_KEY_FALSE(sched_schedstats);
-static bool __initdata __sched_schedstats = false;
 
 static void set_schedstats(bool enabled)
 {
@@ -3672,16 +3671,11 @@ static int __init setup_schedstats(char *str)
 	if (!str)
 		goto out;
 
-	/*
-	 * This code is called before jump labels have been set up, so we can't
-	 * change the static branch directly just yet.  Instead set a temporary
-	 * variable so init_schedstats() can do it later.
-	 */
 	if (!strcmp(str, "enable")) {
-		__sched_schedstats = true;
+		set_schedstats(true);
 		ret = 1;
 	} else if (!strcmp(str, "disable")) {
-		__sched_schedstats = false;
+		set_schedstats(false);
 		ret = 1;
 	}
 out:
@@ -3692,11 +3686,6 @@ static int __init setup_schedstats(char *str)
 }
 __setup("schedstats=", setup_schedstats);
 
-static void __init init_schedstats(void)
-{
-	set_schedstats(__sched_schedstats);
-}
-
 #ifdef CONFIG_PROC_SYSCTL
 int sysctl_schedstats(struct ctl_table *table, int write, void *buffer,
 		size_t *lenp, loff_t *ppos)
@@ -3718,8 +3707,6 @@ int sysctl_schedstats(struct ctl_table *table, int write, void *buffer,
 	return err;
 }
 #endif /* CONFIG_PROC_SYSCTL */
-#else  /* !CONFIG_SCHEDSTATS */
-static inline void init_schedstats(void) {}
 #endif /* CONFIG_SCHEDSTATS */
 
 /*
@@ -8258,8 +8245,6 @@ void __init sched_init(void)
 #endif
 	init_sched_fair_class();
 
-	init_schedstats();
-
 	psi_init();
 
 	init_uclamp();
Signature · 1 line
2.32.0.rc0.204.g9fa02ecfa5-goog
maintainer
#1 lore raw
Quoted 11 lines · Eric Dumazet

From: Eric Dumazet <[email protected]>

Revert "sched/debug: Fix 'schedstats=enable' cmdline option"

This reverts commit 4698f88c06b893f2acc0b443004a53bf490fde7c.

After commit 6041186a3258 ("init: initialize jump labels before command line option parsing") we can rely on jump label infra being ready for use when setup_schedstats() is called.

Thanks!

Acked-by on v1 1/1
#2 lore raw
In reply to Eric Dumazet
Quoted 10 lines · Eric Dumazet

From: Eric Dumazet <[email protected]>

Revert "sched/debug: Fix 'schedstats=enable' cmdline option"

This reverts commit 4698f88c06b893f2acc0b443004a53bf490fde7c.

After commit 6041186a3258 ("init: initialize jump labels before command line option parsing") we can rely on jump label infra being ready for use when setup_schedstats() is called.

Quoted 7 lines
Cc Josh Poimboeuf <[email protected]>
Cc Peter Zijlstra (Intel) <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Dan Williams <[email protected]>
Cc Guenter Roeck <[email protected]>
Cc Kees Cook <[email protected]>
Signature · 1 line
Josh
Reviewed-by on v1 1/1
#3 lore raw
In reply to Eric Dumazet
Quoted 9 lines · Eric Dumazet

From: Eric Dumazet <[email protected]>

Revert "sched/debug: Fix 'schedstats=enable' cmdline option"

This reverts commit 4698f88c06b893f2acc0b443004a53bf490fde7c.

After commit 6041186a3258 ("init: initialize jump labels before command line option parsing") we can rely on jump label infra being ready for use when setup_schedstats() is called.

Ah yeah, good catch.

-Kees

Quoted 76 lines
Cc Josh Poimboeuf <[email protected]>
Cc Peter Zijlstra (Intel) <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Dan Williams <[email protected]>
Cc Guenter Roeck <[email protected]>
Cc Kees Cook <[email protected]>
---
 kernel/sched/core.c | 19 ++-----------------
 1 file changed, 2 insertions(+), 17 deletions(-)
kernel/sched/core.c +2 -17
index 5226cc26a095f427dafa864ff37d39d529e2ba85..105fa6c73e7d9ded05683ee43a11e3b4461932d5 100644
@@ -3648,7 +3648,6 @@ int sysctl_numa_balancing(struct ctl_table *table, int write,
 #ifdef CONFIG_SCHEDSTATS
 
 DEFINE_STATIC_KEY_FALSE(sched_schedstats);
-static bool __initdata __sched_schedstats = false;
 
 static void set_schedstats(bool enabled)
 {
@@ -3672,16 +3671,11 @@ static int __init setup_schedstats(char *str)
 	if (!str)
 		goto out;
 
-	/*
-	 * This code is called before jump labels have been set up, so we can't
-	 * change the static branch directly just yet.  Instead set a temporary
-	 * variable so init_schedstats() can do it later.
-	 */
 	if (!strcmp(str, "enable")) {
-		__sched_schedstats = true;
+		set_schedstats(true);
 		ret = 1;
 	} else if (!strcmp(str, "disable")) {
-		__sched_schedstats = false;
+		set_schedstats(false);
 		ret = 1;
 	}
 out:
@@ -3692,11 +3686,6 @@ static int __init setup_schedstats(char *str)
 }
 __setup("schedstats=", setup_schedstats);
 
-static void __init init_schedstats(void)
-{
-	set_schedstats(__sched_schedstats);
-}
-
 #ifdef CONFIG_PROC_SYSCTL
 int sysctl_schedstats(struct ctl_table *table, int write, void *buffer,
 		size_t *lenp, loff_t *ppos)
@@ -3718,8 +3707,6 @@ int sysctl_schedstats(struct ctl_table *table, int write, void *buffer,
 	return err;
 }
 #endif /* CONFIG_PROC_SYSCTL */
-#else  /* !CONFIG_SCHEDSTATS */
-static inline void init_schedstats(void) {}
 #endif /* CONFIG_SCHEDSTATS */
 
 /*
@@ -8258,8 +8245,6 @@ void __init sched_init(void)
 #endif
 	init_sched_fair_class();
 
-	init_schedstats();
-
 	psi_init();
 
 	init_uclamp();
Signature · 1 line
2.32.0.rc0.204.g9fa02ecfa5-goog
Signature · 1 line
Kees Cook
merge bot Applied
#4 lore raw

[tip: sched/core] sched/debug: Remove obsolete init_schedstats()

In reply to Eric Dumazet
The following commit has been merged into the sched/core branch of tip:

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

Commit-ID:     1faa491a49d53f5d1c8c23bdf01763cfc00a2b19
Gitweb:        https://git.kernel.org/tip/1faa491a49d53f5d1c8c23bdf01763cfc00a2b19
Author:        Eric Dumazet <[email protected]>
AuthorDate:    Wed, 02 Jun 2021 04:21:08 -07:00
Committer:     Peter Zijlstra <[email protected]>
CommitterDate: Fri, 04 Jun 2021 15:38:42 +02:00

sched/debug: Remove obsolete init_schedstats()

Revert commit 4698f88c06b8 ("sched/debug: Fix 'schedstats=enable' cmdline option").

After commit 6041186a3258 ("init: initialize jump labels before command line option parsing") we can rely on jump label infra being ready for use when setup_schedstats() is called.

---
 kernel/sched/core.c | 19 ++-----------------
 1 file changed, 2 insertions(+), 17 deletions(-)
kernel/sched/core.c +2 -17
index 7e59466..9e9a5be 100644
@@ -4009,7 +4009,6 @@ int sysctl_numa_balancing(struct ctl_table *table, int write,
 #ifdef CONFIG_SCHEDSTATS
 
 DEFINE_STATIC_KEY_FALSE(sched_schedstats);
-static bool __initdata __sched_schedstats = false;
 
 static void set_schedstats(bool enabled)
 {
@@ -4033,16 +4032,11 @@ static int __init setup_schedstats(char *str)
 	if (!str)
 		goto out;
 
-	/*
-	 * This code is called before jump labels have been set up, so we can't
-	 * change the static branch directly just yet.  Instead set a temporary
-	 * variable so init_schedstats() can do it later.
-	 */
 	if (!strcmp(str, "enable")) {
-		__sched_schedstats = true;
+		set_schedstats(true);
 		ret = 1;
 	} else if (!strcmp(str, "disable")) {
-		__sched_schedstats = false;
+		set_schedstats(false);
 		ret = 1;
 	}
 out:
@@ -4053,11 +4047,6 @@ out:
 }
 __setup("schedstats=", setup_schedstats);
 
-static void __init init_schedstats(void)
-{
-	set_schedstats(__sched_schedstats);
-}
-
 #ifdef CONFIG_PROC_SYSCTL
 int sysctl_schedstats(struct ctl_table *table, int write, void *buffer,
 		size_t *lenp, loff_t *ppos)
@@ -4079,8 +4068,6 @@ int sysctl_schedstats(struct ctl_table *table, int write, void *buffer,
 	return err;
 }
 #endif /* CONFIG_PROC_SYSCTL */
-#else  /* !CONFIG_SCHEDSTATS */
-static inline void init_schedstats(void) {}
 #endif /* CONFIG_SCHEDSTATS */
 
 /*
@@ -9089,8 +9076,6 @@ void __init sched_init(void)
 #endif
 	init_sched_fair_class();
 
-	init_schedstats();
-
 	psi_init();
 
 	init_uclamp();