Skip to contentSkip to conversation

sched: make sched_set_stop_task() static

PATCH In review Bixuan Cui 2 participants 3 messages May 29, 2021 – May 31, 2021 Scheduler

lore
Share & tools
lore

Bixuan Cui

author
#0 lore raw

PATCH 1/1 sched: make sched_set_stop_task() static

make W=1 generates the following warning for kernel/sched/core.c:
warning: no previous prototype for ‘sched_set_stop_task’ [-Wmissing-prototypes]

---
 kernel/sched/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/sched/core.c +1 -1
index adea0b1e8036..1c1e9612018b 100644
@@ -3209,7 +3209,7 @@ int select_task_rq(struct task_struct *p, int cpu, int wake_flags)
 	return cpu;
 }
 
-void sched_set_stop_task(int cpu, struct task_struct *stop)
+static void sched_set_stop_task(int cpu, struct task_struct *stop)
 {
 	static struct lock_class_key stop_pi_lock;
 	struct sched_param param = { .sched_priority = MAX_RT_PRIO - 1 };
Signature · 1 line
2.17.1
author
#1 lore raw
Quoted 13 lines · Bixuan Cui

make W=1 generates the following warning for kernel/sched/core.c:
warning: no previous prototype for ‘sched_set_stop_task’ [-Wmissing-prototypes]

---
 kernel/sched/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/sched/core.c +0 -0
index adea0b1e8036..1c1e9612018b 100644

kernel/sched/core.c int select_task_rq(struct task_struct *p, int cpu, int wake_flags) · line 3215

Quoted 8 lines
kernel/sched/core.c +1 -1
@@ -3209,7 +3209,7 @@ int select_task_rq(struct task_struct *p, int cpu, int wake_flags)
 	return cpu;
 }
 
-void sched_set_stop_task(int cpu, struct task_struct *stop)
+static void sched_set_stop_task(int cpu, struct task_struct *stop)
 {
 	static struct lock_class_key stop_pi_lock;
 	struct sched_param param = { .sched_priority = MAX_RT_PRIO - 1 };

Hi, This patch will cause compilation errors. Please ignore it. :-(

Thanks
Bixuan Cui

Quoted 1 line
maintainer
#2 lore raw
In reply to Bixuan Cui
Quoted 13 lines · Bixuan Cui

make W=1 generates the following warning for kernel/sched/core.c:
warning: no previous prototype for ‘sched_set_stop_task’ [-Wmissing-prototypes]

---
 kernel/sched/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/sched/core.c +0 -0
index adea0b1e8036..1c1e9612018b 100644

kernel/sched/core.c int select_task_rq(struct task_struct *p, int cpu, int wake_flags) · line 3215

Quoted 8 lines
kernel/sched/core.c +1 -1
@@ -3209,7 +3209,7 @@ int select_task_rq(struct task_struct *p, int cpu, int wake_flags)
 	return cpu;
 }
 
-void sched_set_stop_task(int cpu, struct task_struct *stop)
+static void sched_set_stop_task(int cpu, struct task_struct *stop)
 {
 	static struct lock_class_key stop_pi_lock;
 	struct sched_param param = { .sched_priority = MAX_RT_PRIO - 1 };

Clearly you tested this well...

$ git grep sched_set_stop_task
kernel/sched/core.c:void sched_set_stop_task(int cpu, struct task_struct *stop)
kernel/stop_machine.c:extern void sched_set_stop_task(int cpu, struct task_struct *stop);
kernel/stop_machine.c:  sched_set_stop_task(cpu, per_cpu(cpu_stopper.thread, cpu));

Please be more careful.