summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2005-01-07 21:49:36 -0800
committerLinus Torvalds <torvalds@evo.osdl.org>2005-01-07 21:49:36 -0800
commitf6aaca35e0aa4c7e3de79ace85f7380f4d451648 (patch)
treebcd1e7b3e355dc2f2c1d71c8b2deb023ac36d074 /include/linux
parent3365d1671c8f5f1ede7a07dcc632e70a385f27ad (diff)
[PATCH] add lock_need_resched()
Add lock_need_resched() which is to check for the necessity of lock-break in a critical section. Used by later latency-break patches. tested on x86, should work on all architectures. Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/sched.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 2b2282104bb4..c69d26d50fb0 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1083,6 +1083,17 @@ extern int cond_resched_lock(spinlock_t * lock);
# define need_lockbreak(lock) 0
#endif
+/*
+ * Does a critical section need to be broken due to another
+ * task waiting or preemption being signalled:
+ */
+static inline int lock_need_resched(spinlock_t *lock)
+{
+ if (need_lockbreak(lock) || need_resched())
+ return 1;
+ return 0;
+}
+
/* Reevaluate whether the task has signals pending delivery.
This is required every time the blocked sigset_t changes.
callers must hold sighand->siglock. */