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.
Unified · Split
| @@ -4009,7 +4009,6 @@ int sysctl_numa_balancing(struct ctl_table *table, int write, · 4008 unmodified lines | |||
| 4009 | #ifdef CONFIG_SCHEDSTATS | 4009 | #ifdef CONFIG_SCHEDSTATS |
| 4010 | 4010 | ||
| 4011 | DEFINE_STATIC_KEY_FALSE(sched_schedstats); | 4011 | DEFINE_STATIC_KEY_FALSE(sched_schedstats); |
| 4012 | static bool __initdata __sched_schedstats = false; | ||
| 4013 | 4012 | ||
| 4014 | static void set_schedstats(bool enabled) | 4013 | static void set_schedstats(bool enabled) |
| 4015 | { | 4014 | { |
| @@ -4033,16 +4032,11 @@ static int __init setup_schedstats(char *str) · 17 unmodified lines | |||
| 4033 | if (!str) | 4032 | if (!str) |
| 4034 | goto out; | 4033 | goto out; |
| 4035 | 4034 | ||
| 4036 | /* | ||
| 4037 | * This code is called before jump labels have been set up, so we can't | ||
| 4038 | * change the static branch directly just yet. Instead set a temporary | ||
| 4039 | * variable so init_schedstats() can do it later. | ||
| 4040 | */ | ||
| 4041 | if (!strcmp(str, "enable")) { | 4035 | if (!strcmp(str, "enable")) { |
| 4042 | __sched_schedstats = true; | 4036 | set_schedstats(true); |
| 4043 | ret = 1; | 4037 | ret = 1; |
| 4044 | } else if (!strcmp(str, "disable")) { | 4038 | } else if (!strcmp(str, "disable")) { |
| 4045 | __sched_schedstats = false; | 4039 | set_schedstats(false); |
| 4046 | ret = 1; | 4040 | ret = 1; |
| 4047 | } | 4041 | } |
| 4048 | out: | 4042 | out: |
| @@ -4053,11 +4047,6 @@ out: · 4 unmodified lines | |||
| 4053 | } | 4047 | } |
| 4054 | __setup("schedstats=", setup_schedstats); | 4048 | __setup("schedstats=", setup_schedstats); |
| 4055 | 4049 | ||
| 4056 | static void __init init_schedstats(void) | ||
| 4057 | { | ||
| 4058 | set_schedstats(__sched_schedstats); | ||
| 4059 | } | ||
| 4060 | |||
| 4061 | #ifdef CONFIG_PROC_SYSCTL | 4050 | #ifdef CONFIG_PROC_SYSCTL |
| 4062 | int sysctl_schedstats(struct ctl_table *table, int write, void *buffer, | 4051 | int sysctl_schedstats(struct ctl_table *table, int write, void *buffer, |
| 4063 | size_t *lenp, loff_t *ppos) | 4052 | size_t *lenp, loff_t *ppos) |
| @@ -4079,8 +4068,6 @@ int sysctl_schedstats(struct ctl_table *table, int write, void *buffer, · 15 unmodified lines | |||
| 4079 | return err; | 4068 | return err; |
| 4080 | } | 4069 | } |
| 4081 | #endif /* CONFIG_PROC_SYSCTL */ | 4070 | #endif /* CONFIG_PROC_SYSCTL */ |
| 4082 | #else /* !CONFIG_SCHEDSTATS */ | ||
| 4083 | static inline void init_schedstats(void) {} | ||
| 4084 | #endif /* CONFIG_SCHEDSTATS */ | 4071 | #endif /* CONFIG_SCHEDSTATS */ |
| 4085 | 4072 | ||
| 4086 | /* | 4073 | /* |
| @@ -9089,8 +9076,6 @@ void __init sched_init(void) · 5002 unmodified lines | |||
| 9089 | #endif | 9076 | #endif |
| 9090 | init_sched_fair_class(); | 9077 | init_sched_fair_class(); |
| 9091 | 9078 | ||
| 9092 | init_schedstats(); | ||
| 9093 | |||
| 9094 | psi_init(); | 9079 | psi_init(); |
| 9095 | 9080 | ||
| 9096 | init_uclamp(); | 9081 | init_uclamp(); |