Re: [GIT PULL] scheduler changes for v2.6.38
From: Linus Torvalds
Date: Thu Jan 06 2011 - 13:28:37 EST
Ingo, can we please not do things like this:
> diff --git a/kernel/trace/trace_selftest.c b/kernel/trace/trace_selftest.c
> index 155a415..562c56e 100644
> --- a/kernel/trace/trace_selftest.c
> +++ b/kernel/trace/trace_selftest.c
> @@ -558,7 +558,7 @@ trace_selftest_startup_nop(struct tracer *trace, struct trace_array *tr)
> static int trace_wakeup_test_thread(void *data)
> {
> /* Make this a RT thread, doesn't need to be too high */
> - struct sched_param param = { .sched_priority = 5 };
> + static struct sched_param param = { .sched_priority = 5 };
> struct completion *x = data;
>
> sched_setscheduler(current, SCHED_FIFO, ¶m);
> diff --git a/kernel/watchdog.c b/kernel/watchdog.c
> index 5b08215..c812c49 100644
> --- a/kernel/watchdog.c
> +++ b/kernel/watchdog.c
> @@ -307,7 +307,7 @@ static enum hrtimer_restart watchdog_timer_fn(struct hrtimer *hrtimer)
> */
> static int watchdog(void *unused)
> {
> - struct sched_param param = { .sched_priority = MAX_RT_PRIO-1 };
> + static struct sched_param param = { .sched_priority = MAX_RT_PRIO-1 };
> struct hrtimer *hrtimer = &__raw_get_cpu_var(watchdog_hrtimer);
>
> sched_setscheduler(current, SCHED_FIFO, ¶m);
It's just nasty and horrible.
Now, something like
"static const struct sched_param param = .."
is fine, if it's really a const thing. But if it's non-const, don't
make it be a static inside a function. Please.
Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/