]> git.baikalelectronics.ru Git - kernel.git/commit
[PATCH] Conditionally check expected_preempt_count in __resched_legal()
authorMark Fasheh <mark.fasheh@oracle.com>
Fri, 22 Dec 2006 09:06:15 +0000 (01:06 -0800)
committerLinus Torvalds <torvalds@woody.osdl.org>
Fri, 22 Dec 2006 16:55:46 +0000 (08:55 -0800)
commite9a1ad24048d16459b872becf92359cdaa2684d2
tree402f1d6a726413a734ab05415a8f3277d23310e7
parentb1d0b8b472f2461eceb9eecd4a1fc6d57f9e991f
[PATCH] Conditionally check expected_preempt_count in __resched_legal()

Commit 15f8bec6987d0b05e2f07d8b31471077f49df8c1 ("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 <mark.fasheh@oracle.com>
Acked-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
kernel/sched.c