aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/linux/preempt.h15
-rw-r--r--include/linux/sched.h15
2 files changed, 30 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() \
139do { \
140 set_preempt_need_resched(); \
141} while (0)
142#define preempt_fold_need_resched() \
143do { \
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
139struct preempt_notifier; 154struct preempt_notifier;
diff --git a/include/linux/sched.h b/include/linux/sched.h
index a03875221663..ffccdad050b5 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -2745,6 +2745,21 @@ static inline bool __must_check current_clr_polling_and_test(void)
2745} 2745}
2746#endif 2746#endif
2747 2747
2748static inline void current_clr_polling(void)
2749{
2750 __current_clr_polling();
2751
2752 /*
2753 * Ensure we check TIF_NEED_RESCHED after we clear the polling bit.
2754 * Once the bit is cleared, we'll get IPIs with every new
2755 * TIF_NEED_RESCHED and the IPI handler, scheduler_ipi(), will also
2756 * fold.
2757 */
2758 smp_mb(); /* paired with resched_task() */
2759
2760 preempt_fold_need_resched();
2761}
2762
2748static __always_inline bool need_resched(void) 2763static __always_inline bool need_resched(void)
2749{ 2764{
2750 return unlikely(tif_need_resched()); 2765 return unlikely(tif_need_resched());