Skip to content

Commit

Permalink
sched: Cover the CONFIG_DEBUG_SPINLOCK_SLEEP off-case for __might_sle…
Browse files Browse the repository at this point in the history
…ep()

Cover the off case for __might_sleep(), so that we avoid
#ifdefs in files that make use of it. Especially, this prepares
for the __might_sleep() pull up on cond_resched().

Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <1247725694-6082-3-git-send-email-fweisbec@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
Frederic Weisbecker authored and Ingo Molnar committed Jul 18, 2009
1 parent 4b21556 commit e09758f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
1 change: 1 addition & 0 deletions include/linux/kernel.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ extern int _cond_resched(void);
# define might_sleep() \
do { __might_sleep(__FILE__, __LINE__); might_resched(); } while (0)
#else
static inline void __might_sleep(char *file, int line) { }
# define might_sleep() do { might_resched(); } while (0)
#endif

Expand Down
3 changes: 1 addition & 2 deletions kernel/sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -6610,9 +6610,8 @@ static inline int should_resched(void)

static void __cond_resched(void)
{
#ifdef CONFIG_DEBUG_SPINLOCK_SLEEP
__might_sleep(__FILE__, __LINE__);
#endif

add_preempt_count(PREEMPT_ACTIVE);
schedule();
sub_preempt_count(PREEMPT_ACTIVE);
Expand Down

0 comments on commit e09758f

Please sign in to comment.