summaryrefslogtreecommitdiffstats
path: root/include/linux/sched.h
diff options
context:
space:
mode:
authorPeter Zijlstra <peterz@infradead.org>2016-09-19 12:57:53 +0200
committerIngo Molnar <mingo@kernel.org>2016-09-22 14:53:46 +0200
commit35a773a07926a22bf19d77ee00024522279c4e68 (patch)
tree23f24c6a2932df3cb5078e438abbfb1966e4733b /include/linux/sched.h
parent9af6528ee9b682df7f29dbee86fbba0b67eab944 (diff)
downloadop-kernel-dev-35a773a07926a22bf19d77ee00024522279c4e68.zip
op-kernel-dev-35a773a07926a22bf19d77ee00024522279c4e68.tar.gz
sched/core: Avoid _cond_resched() for PREEMPT=y
On fully preemptible kernels _cond_resched() is pointless, so avoid emitting any code for it. Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Mikulas Patocka <mpatocka@redhat.com> Cc: Oleg Nesterov <oleg@redhat.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: linux-kernel@vger.kernel.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'include/linux/sched.h')
-rw-r--r--include/linux/sched.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h
index f00ee8e..b99fcd1 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -3209,7 +3209,11 @@ static inline int signal_pending_state(long state, struct task_struct *p)
* cond_resched_lock() will drop the spinlock before scheduling,
* cond_resched_softirq() will enable bhs before scheduling.
*/
+#ifndef CONFIG_PREEMPT
extern int _cond_resched(void);
+#else
+static inline int _cond_resched(void) { return 0; }
+#endif
#define cond_resched() ({ \
___might_sleep(__FILE__, __LINE__, 0); \
OpenPOWER on IntegriCloud