linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] sched/debug: remove obsolete init_schedstats()
@ 2021-06-02 11:21 Eric Dumazet
  2021-06-02 13:40 ` Peter Zijlstra
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Eric Dumazet @ 2021-06-02 11:21 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Eric Dumazet, Eric Dumazet, Josh Poimboeuf,
	Peter Zijlstra, Dan Williams, Guenter Roeck, Kees Cook

From: Eric Dumazet <edumazet@google.com>

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.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Guenter Roeck <groeck@google.com>
Cc: Kees Cook <keescook@chromium.org>
---
 kernel/sched/core.c | 19 ++-----------------
 1 file changed, 2 insertions(+), 17 deletions(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 5226cc26a095f427dafa864ff37d39d529e2ba85..105fa6c73e7d9ded05683ee43a11e3b4461932d5 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -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();
-- 
2.32.0.rc0.204.g9fa02ecfa5-goog


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

* Re: [PATCH] sched/debug: remove obsolete init_schedstats()
  2021-06-02 11:21 [PATCH] sched/debug: remove obsolete init_schedstats() Eric Dumazet
@ 2021-06-02 13:40 ` Peter Zijlstra
  2021-06-02 14:59 ` Josh Poimboeuf
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Peter Zijlstra @ 2021-06-02 13:40 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: Ingo Molnar, linux-kernel, Eric Dumazet, Josh Poimboeuf,
	Dan Williams, Guenter Roeck, Kees Cook

On Wed, Jun 02, 2021 at 04:21:08AM -0700, Eric Dumazet wrote:
> From: Eric Dumazet <edumazet@google.com>
> 
> 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.
> 
> Signed-off-by: Eric Dumazet <edumazet@google.com>

Thanks!

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

* Re: [PATCH] sched/debug: remove obsolete init_schedstats()
  2021-06-02 11:21 [PATCH] sched/debug: remove obsolete init_schedstats() Eric Dumazet
  2021-06-02 13:40 ` Peter Zijlstra
@ 2021-06-02 14:59 ` Josh Poimboeuf
  2021-06-02 17:46 ` Kees Cook
  2021-06-04 13:44 ` [tip: sched/core] sched/debug: Remove " tip-bot2 for Eric Dumazet
  3 siblings, 0 replies; 5+ messages in thread
From: Josh Poimboeuf @ 2021-06-02 14:59 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: Ingo Molnar, linux-kernel, Eric Dumazet, Peter Zijlstra,
	Dan Williams, Guenter Roeck, Kees Cook

On Wed, Jun 02, 2021 at 04:21:08AM -0700, Eric Dumazet wrote:
> From: Eric Dumazet <edumazet@google.com>
> 
> 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.
> 
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Cc: Josh Poimboeuf <jpoimboe@redhat.com>
> Cc: Peter Zijlstra (Intel) <peterz@infradead.org>
> Cc: Ingo Molnar <mingo@kernel.org>
> Cc: Dan Williams <dan.j.williams@intel.com>
> Cc: Guenter Roeck <groeck@google.com>
> Cc: Kees Cook <keescook@chromium.org>

Acked-by: Josh Poimboeuf <jpoimboe@redhat.com>

-- 
Josh


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

* Re: [PATCH] sched/debug: remove obsolete init_schedstats()
  2021-06-02 11:21 [PATCH] sched/debug: remove obsolete init_schedstats() Eric Dumazet
  2021-06-02 13:40 ` Peter Zijlstra
  2021-06-02 14:59 ` Josh Poimboeuf
@ 2021-06-02 17:46 ` Kees Cook
  2021-06-04 13:44 ` [tip: sched/core] sched/debug: Remove " tip-bot2 for Eric Dumazet
  3 siblings, 0 replies; 5+ messages in thread
From: Kees Cook @ 2021-06-02 17:46 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: Ingo Molnar, linux-kernel, Eric Dumazet, Josh Poimboeuf,
	Peter Zijlstra, Dan Williams, Guenter Roeck

On Wed, Jun 02, 2021 at 04:21:08AM -0700, Eric Dumazet wrote:
> From: Eric Dumazet <edumazet@google.com>
> 
> 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.

Reviewed-by: Kees Cook <keescook@chromium.org>

-Kees

> 
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Cc: Josh Poimboeuf <jpoimboe@redhat.com>
> Cc: Peter Zijlstra (Intel) <peterz@infradead.org>
> Cc: Ingo Molnar <mingo@kernel.org>
> Cc: Dan Williams <dan.j.williams@intel.com>
> Cc: Guenter Roeck <groeck@google.com>
> Cc: Kees Cook <keescook@chromium.org>
> ---
>  kernel/sched/core.c | 19 ++-----------------
>  1 file changed, 2 insertions(+), 17 deletions(-)
> 
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index 5226cc26a095f427dafa864ff37d39d529e2ba85..105fa6c73e7d9ded05683ee43a11e3b4461932d5 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -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();
> -- 
> 2.32.0.rc0.204.g9fa02ecfa5-goog
> 

-- 
Kees Cook

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

* [tip: sched/core] sched/debug: Remove obsolete init_schedstats()
  2021-06-02 11:21 [PATCH] sched/debug: remove obsolete init_schedstats() Eric Dumazet
                   ` (2 preceding siblings ...)
  2021-06-02 17:46 ` Kees Cook
@ 2021-06-04 13:44 ` tip-bot2 for Eric Dumazet
  3 siblings, 0 replies; 5+ messages in thread
From: tip-bot2 for Eric Dumazet @ 2021-06-04 13:44 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Eric Dumazet, Peter Zijlstra (Intel),
	Kees Cook, Josh Poimboeuf, x86, linux-kernel

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 <edumazet@google.com>
AuthorDate:    Wed, 02 Jun 2021 04:21:08 -07:00
Committer:     Peter Zijlstra <peterz@infradead.org>
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.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Kees Cook <keescook@chromium.org>
Acked-by: Josh Poimboeuf <jpoimboe@redhat.com>
Link: https://lkml.kernel.org/r/20210602112108.1709635-1-eric.dumazet@gmail.com
---
 kernel/sched/core.c | 19 ++-----------------
 1 file changed, 2 insertions(+), 17 deletions(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 7e59466..9e9a5be 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -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();

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

end of thread, other threads:[~2021-06-04 13:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-02 11:21 [PATCH] sched/debug: remove obsolete init_schedstats() Eric Dumazet
2021-06-02 13:40 ` Peter Zijlstra
2021-06-02 14:59 ` Josh Poimboeuf
2021-06-02 17:46 ` Kees Cook
2021-06-04 13:44 ` [tip: sched/core] sched/debug: Remove " tip-bot2 for Eric Dumazet

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