sched/preempt: Fix cond_resched_lock() and cond_resched_softirq()
[cascardo/linux.git] / include / asm-generic / preempt.h
index d0a7a47..0bec580 100644 (file)
@@ -71,9 +71,10 @@ static __always_inline bool __preempt_count_dec_and_test(void)
 /*
  * Returns true when we need to resched and can (barring IRQ state).
  */
-static __always_inline bool should_resched(void)
+static __always_inline bool should_resched(int preempt_offset)
 {
-       return unlikely(!preempt_count() && tif_need_resched());
+       return unlikely(preempt_count() == preempt_offset &&
+                       tif_need_resched());
 }
 
 #ifdef CONFIG_PREEMPT