diff options
author | Peter Zijlstra <peterz@infradead.org> | 2014-09-24 04:18:56 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2014-10-28 05:56:57 -0400 |
commit | 3427445afd26bd2395f29241319283a93f362cd0 (patch) | |
tree | 7c1b04953b3744a518bfb380d63dc5f518ce8100 /kernel/sched | |
parent | 8eb23b9f35aae413140d3fda766a98092c21e9b0 (diff) |
sched: Exclude cond_resched() from nested sleep test
cond_resched() is a preemption point, not strictly a blocking
primitive, so exclude it from the ->state test.
In particular, preemption preserves task_struct::state.
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: tglx@linutronix.de
Cc: ilya.dryomov@inktank.com
Cc: umgwanakikbuti@gmail.com
Cc: oleg@redhat.com
Cc: Alex Elder <alex.elder@linaro.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Axel Lin <axel.lin@ingics.com>
Cc: Daniel Borkmann <dborkman@redhat.com>
Cc: Dave Jones <davej@redhat.com>
Cc: Jason Baron <jbaron@akamai.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/20140924082242.656559952@infradead.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'kernel/sched')
-rw-r--r-- | kernel/sched/core.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 5b4b96b27cd7..b9f78f12ac22 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c | |||
@@ -7296,8 +7296,6 @@ static inline int preempt_count_equals(int preempt_offset) | |||
7296 | 7296 | ||
7297 | void __might_sleep(const char *file, int line, int preempt_offset) | 7297 | void __might_sleep(const char *file, int line, int preempt_offset) |
7298 | { | 7298 | { |
7299 | static unsigned long prev_jiffy; /* ratelimiting */ | ||
7300 | |||
7301 | /* | 7299 | /* |
7302 | * Blocking primitives will set (and therefore destroy) current->state, | 7300 | * Blocking primitives will set (and therefore destroy) current->state, |
7303 | * since we will exit with TASK_RUNNING make sure we enter with it, | 7301 | * since we will exit with TASK_RUNNING make sure we enter with it, |
@@ -7311,6 +7309,14 @@ void __might_sleep(const char *file, int line, int preempt_offset) | |||
7311 | (void *)current->task_state_change)) | 7309 | (void *)current->task_state_change)) |
7312 | __set_current_state(TASK_RUNNING); | 7310 | __set_current_state(TASK_RUNNING); |
7313 | 7311 | ||
7312 | ___might_sleep(file, line, preempt_offset); | ||
7313 | } | ||
7314 | EXPORT_SYMBOL(__might_sleep); | ||
7315 | |||
7316 | void ___might_sleep(const char *file, int line, int preempt_offset) | ||
7317 | { | ||
7318 | static unsigned long prev_jiffy; /* ratelimiting */ | ||
7319 | |||
7314 | rcu_sleep_check(); /* WARN_ON_ONCE() by default, no rate limit reqd. */ | 7320 | rcu_sleep_check(); /* WARN_ON_ONCE() by default, no rate limit reqd. */ |
7315 | if ((preempt_count_equals(preempt_offset) && !irqs_disabled() && | 7321 | if ((preempt_count_equals(preempt_offset) && !irqs_disabled() && |
7316 | !is_idle_task(current)) || | 7322 | !is_idle_task(current)) || |
@@ -7340,7 +7346,7 @@ void __might_sleep(const char *file, int line, int preempt_offset) | |||
7340 | #endif | 7346 | #endif |
7341 | dump_stack(); | 7347 | dump_stack(); |
7342 | } | 7348 | } |
7343 | EXPORT_SYMBOL(__might_sleep); | 7349 | EXPORT_SYMBOL(___might_sleep); |
7344 | #endif | 7350 | #endif |
7345 | 7351 | ||
7346 | #ifdef CONFIG_MAGIC_SYSRQ | 7352 | #ifdef CONFIG_MAGIC_SYSRQ |