[patch] preempt-lock-need-resched.patch, 2.6.9-rc2

Ingo Molnar
2004-09-14T09:38:53Z

[-- Attachment #1: Type: text/plain, Size: 299 bytes --]

the attached preempt-lock-need-resched.patch is ontop of the preempt-smp
and preempt-cleanups patches. It adds 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.

Ingo

[-- Attachment #2: preempt-lock-need-resched.patch --]
[-- Type: text/plain, Size: 933 bytes --]

the attached preempt-lock-need-resched.patch is ontop of the preempt-smp
and preempt-cleanups patches. It adds 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>

--- linux/include/linux/sched.h.orig
+++ linux/include/linux/sched.h
@@ -969,6 +972,17 @@ extern int cond_resched_lock(spinlock_t
# 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. */