Commit:     ba0084048ab785c2cb1d6cc2cccabe642a5b799a
Parent:     2aea4fb61609ba7ef82f7dc6fca116bda88816e1
Author:     Mark Fasheh <[EMAIL PROTECTED]>
AuthorDate: Fri Dec 22 01:06:15 2006 -0800
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Fri Dec 22 08:55:46 2006 -0800

    [PATCH] Conditionally check expected_preempt_count in __resched_legal()
    Commit 2d7d253548cffdce80f4e03664686e9ccb1b0ed7 ("fix cond_resched() fix")
    introduced an 'expected_preempt_count' parameter to __resched_legal() to
    fix a bug where it was returning a false negative when called from
    cond_resched_lock() and preemption was enabled.
    Unfortunately this broke things for when preemption is disabled.
    preempt_count() will always return zero, thus failing the check against any
    value of expected_preempt_count not equal to zero.  cond_resched_lock() for
    example, passes an expected_preempt_count value of 1.
    So fix the fix for the cond_resched() fix by skipping the check of
    preempt_count() against expected_preempt_count when preemption is disabled.
    Credit should go to Sunil Mushran for spotting the bug during testing.
    Signed-off-by: Mark Fasheh <[EMAIL PROTECTED]>
    Acked-by: Ingo Molnar <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
 kernel/sched.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/kernel/sched.c b/kernel/sched.c
index b81ed87..850bde4 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -4619,8 +4619,10 @@ asmlinkage long sys_sched_yield(void)
 static inline int __resched_legal(int expected_preempt_count)
        if (unlikely(preempt_count() != expected_preempt_count))
                return 0;
        if (unlikely(system_state != SYSTEM_RUNNING))
                return 0;
        return 1;
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at

Reply via email to