Commit c9b5f501ef1580faa30c40c644b7691870462201
Committed by
Ingo Molnar
1 parent
524429c31b
Exists in
master
and in
7 other branches
sched: Constify function scope static struct sched_param usage
Function-scope statics are discouraged because they are easily overlooked and can cause subtle bugs/races due to their global (non-SMP safe) nature. Linus noticed that we did this for sched_param - at minimum make the const. Suggested-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> LKML-Reference: Message-ID: <AANLkTinotRxScOHEb0HgFgSpGPkq_6jKTv5CfvnQM=ee@mail.gmail.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Showing 4 changed files with 4 additions and 4 deletions Side-by-side Diff
kernel/irq/manage.c
kernel/kthread.c
| ... | ... | @@ -148,7 +148,7 @@ |
| 148 | 148 | wait_for_completion(&create.done); |
| 149 | 149 | |
| 150 | 150 | if (!IS_ERR(create.result)) { |
| 151 | - static struct sched_param param = { .sched_priority = 0 }; | |
| 151 | + static const struct sched_param param = { .sched_priority = 0 }; | |
| 152 | 152 | va_list args; |
| 153 | 153 | |
| 154 | 154 | va_start(args, namefmt); |
kernel/softirq.c
kernel/trace/trace_selftest.c
| ... | ... | @@ -558,7 +558,7 @@ |
| 558 | 558 | static int trace_wakeup_test_thread(void *data) |
| 559 | 559 | { |
| 560 | 560 | /* Make this a RT thread, doesn't need to be too high */ |
| 561 | - static struct sched_param param = { .sched_priority = 5 }; | |
| 561 | + static const struct sched_param param = { .sched_priority = 5 }; | |
| 562 | 562 | struct completion *x = data; |
| 563 | 563 | |
| 564 | 564 | sched_setscheduler(current, SCHED_FIFO, ¶m); |