diff options
author | Peter Zijlstra <peterz@infradead.org> | 2013-11-20 06:22:37 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2014-01-13 11:38:55 -0500 |
commit | 8cb75e0c4ec9786b81439761eac1d18d4a931af3 (patch) | |
tree | 9d13e6c3580a36cd76d1b3a96827795949519409 /include/linux/preempt.h | |
parent | c9c8986847d2f4fc474c10ee08afa57e7474096d (diff) |
sched/preempt: Fix up missed PREEMPT_NEED_RESCHED folding
With various drivers wanting to inject idle time; we get people
calling idle routines outside of the idle loop proper.
Therefore we need to be extra careful about not missing
TIF_NEED_RESCHED -> PREEMPT_NEED_RESCHED propagations.
While looking at this, I also realized there's a small window in the
existing idle loop where we can miss TIF_NEED_RESCHED; when it hits
right after the tif_need_resched() test at the end of the loop but
right before the need_resched() test at the start of the loop.
So move preempt_fold_need_resched() out of the loop where we're
guaranteed to have TIF_NEED_RESCHED set.
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/n/tip-x9jgh45oeayzajz2mjt0y7d6@git.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'include/linux/preempt.h')
-rw-r--r-- | include/linux/preempt.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/include/linux/preempt.h b/include/linux/preempt.h index dd9ddf8af205..59749fc48328 100644 --- a/include/linux/preempt.h +++ b/include/linux/preempt.h | |||
@@ -134,6 +134,21 @@ do { \ | |||
134 | #undef preempt_check_resched | 134 | #undef preempt_check_resched |
135 | #endif | 135 | #endif |
136 | 136 | ||
137 | #ifdef CONFIG_PREEMPT | ||
138 | #define preempt_set_need_resched() \ | ||
139 | do { \ | ||
140 | set_preempt_need_resched(); \ | ||
141 | } while (0) | ||
142 | #define preempt_fold_need_resched() \ | ||
143 | do { \ | ||
144 | if (tif_need_resched()) \ | ||
145 | set_preempt_need_resched(); \ | ||
146 | } while (0) | ||
147 | #else | ||
148 | #define preempt_set_need_resched() do { } while (0) | ||
149 | #define preempt_fold_need_resched() do { } while (0) | ||
150 | #endif | ||
151 | |||
137 | #ifdef CONFIG_PREEMPT_NOTIFIERS | 152 | #ifdef CONFIG_PREEMPT_NOTIFIERS |
138 | 153 | ||
139 | struct preempt_notifier; | 154 | struct preempt_notifier; |