+ conditionally-check-expected_preempt_count-in-__resched_legal.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled
     Conditionally check expected_preempt_count in __resched_legal()
has been added to the -mm tree.  Its filename is
     conditionally-check-expected_preempt_count-in-__resched_legal.patch

See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find
out what to do about this

------------------------------------------------------
Subject: Conditionally check expected_preempt_count in __resched_legal()
From: Mark Fasheh <mark.fasheh@xxxxxxxxxx>

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 <mark.fasheh@xxxxxxxxxx>
Acked-by: Ingo Molnar <mingo@xxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxx>
---

 kernel/sched.c |    2 ++
 1 files changed, 2 insertions(+)

diff -puN kernel/sched.c~conditionally-check-expected_preempt_count-in-__resched_legal kernel/sched.c
--- a/kernel/sched.c~conditionally-check-expected_preempt_count-in-__resched_legal
+++ a/kernel/sched.c
@@ -4627,8 +4627,10 @@ asmlinkage long sys_sched_yield(void)
 
 static inline int __resched_legal(int expected_preempt_count)
 {
+#ifdef CONFIG_PREEMPT
 	if (unlikely(preempt_count() != expected_preempt_count))
 		return 0;
+#endif
 	if (unlikely(system_state != SYSTEM_RUNNING))
 		return 0;
 	return 1;
_

Patches currently in -mm which might be from mark.fasheh@xxxxxxxxxx are

origin.patch
touch_atime-cleanup.patch
relative-atime.patch
ocfs2-relative-atime-support.patch
fix-numerous-kcalloc-calls-convert-to-kzalloc.patch
conditionally-check-expected_preempt_count-in-__resched_legal.patch
git-ocfs2.patch

-
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux