[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1247237391-5352-2-git-send-email-fweisbec@gmail.com>
Date: Fri, 10 Jul 2009 16:49:51 +0200
From: Frederic Weisbecker <fweisbec@...il.com>
To: Ingo Molnar <mingo@...e.hu>
Cc: LKML <linux-kernel@...r.kernel.org>,
Frederic Weisbecker <fweisbec@...il.com>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>
Subject: [PATCH 2/2] sched: Move the sleeping while atomic checks early in cond_resched()
might_sleep() is called lately in cond_resched(), after the
need_resched()/preempt enabled/system running tests are checked.
It's better to check the sleeps while atomic earlier and not depend
on some environment datas that reduce the chances to detect a
problem.
Signed-off-by: Frederic Weisbecker <fweisbec@...il.com>
Cc: Peter Zijlstra <a.p.zijlstra@...llo.nl>
---
include/linux/sched.h | 2 ++
kernel/sched.c | 3 ---
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 0cb0d8d..e357dc7 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -2279,11 +2279,13 @@ extern int _cond_resched(void);
#ifdef CONFIG_PREEMPT_BKL
static inline int cond_resched(void)
{
+ might_sleep();
return 0;
}
#else
static inline int cond_resched(void)
{
+ might_sleep();
return _cond_resched();
}
#endif
diff --git a/kernel/sched.c b/kernel/sched.c
index 87ecac1..c22804b 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -6605,9 +6605,6 @@ SYSCALL_DEFINE0(sched_yield)
static void __cond_resched(void)
{
-#ifdef CONFIG_DEBUG_SPINLOCK_SLEEP
- __might_sleep(__FILE__, __LINE__);
-#endif
/*
* The BKS might be reacquired before we have dropped
* PREEMPT_ACTIVE, which could trigger a second
--
1.6.2.3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists