]> git.hungrycats.org Git - linux/commitdiff
[PATCH] add lock_need_resched()
authorIngo Molnar <mingo@elte.hu>
Sat, 8 Jan 2005 05:49:36 +0000 (21:49 -0800)
committerLinus Torvalds <torvalds@evo.osdl.org>
Sat, 8 Jan 2005 05:49:36 +0000 (21:49 -0800)
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>
include/linux/sched.h

index 2b2282104bb4dcc6380b0f9adbff1795a0668314..c69d26d50fb079de4b1f3a7eb2aa7544c8fec253 100644 (file)
@@ -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.  */