Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 45113
b: refs/heads/master
c: 9414232
h: refs/heads/master
i:
  45111: cea814a
v: v3
  • Loading branch information
Ingo Molnar authored and Linus Torvalds committed Dec 30, 2006
1 parent 3683402 commit 8fe5388
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 15 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d449db98d5d7d90f29f9f6e091b0e1d996184df1
refs/heads/master: 9414232fa0cc28e2f51b8c76d260f2748f7953fc
18 changes: 4 additions & 14 deletions trunk/kernel/sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -4617,17 +4617,6 @@ asmlinkage long sys_sched_yield(void)
return 0;
}

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;
}

static void __cond_resched(void)
{
#ifdef CONFIG_DEBUG_SPINLOCK_SLEEP
Expand All @@ -4647,7 +4636,8 @@ static void __cond_resched(void)

int __sched cond_resched(void)
{
if (need_resched() && __resched_legal(0)) {
if (need_resched() && !(preempt_count() & PREEMPT_ACTIVE) &&
system_state == SYSTEM_RUNNING) {
__cond_resched();
return 1;
}
Expand All @@ -4673,7 +4663,7 @@ int cond_resched_lock(spinlock_t *lock)
ret = 1;
spin_lock(lock);
}
if (need_resched() && __resched_legal(1)) {
if (need_resched() && system_state == SYSTEM_RUNNING) {
spin_release(&lock->dep_map, 1, _THIS_IP_);
_raw_spin_unlock(lock);
preempt_enable_no_resched();
Expand All @@ -4689,7 +4679,7 @@ int __sched cond_resched_softirq(void)
{
BUG_ON(!in_softirq());

if (need_resched() && __resched_legal(0)) {
if (need_resched() && system_state == SYSTEM_RUNNING) {
raw_local_irq_disable();
_local_bh_enable();
raw_local_irq_enable();
Expand Down

0 comments on commit 8fe5388

Please sign in to comment.