Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 257159
b: refs/heads/master
c: 307bf98
h: refs/heads/master
i:
  257157: 2631663
  257155: a1760ea
  257151: 713fc05
v: v3
  • Loading branch information
Thomas Gleixner authored and Ingo Molnar committed Jul 1, 2011
1 parent 5a86b04 commit f146b8d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 17 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: 2a46dae38087e62dd5fb08a6dadf1407717ed13c
refs/heads/master: 307bf9803f25a8a3f53c1012110fb74e2f893eb0
25 changes: 9 additions & 16 deletions trunk/kernel/sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -4306,11 +4306,8 @@ EXPORT_SYMBOL(schedule);

static inline bool owner_running(struct mutex *lock, struct task_struct *owner)
{
bool ret = false;

rcu_read_lock();
if (lock->owner != owner)
goto fail;
return false;

/*
* Ensure we emit the owner->on_cpu, dereference _after_ checking
Expand All @@ -4320,11 +4317,7 @@ static inline bool owner_running(struct mutex *lock, struct task_struct *owner)
*/
barrier();

ret = owner->on_cpu;
fail:
rcu_read_unlock();

return ret;
return owner->on_cpu;
}

/*
Expand All @@ -4336,21 +4329,21 @@ int mutex_spin_on_owner(struct mutex *lock, struct task_struct *owner)
if (!sched_feat(OWNER_SPIN))
return 0;

rcu_read_lock();
while (owner_running(lock, owner)) {
if (need_resched())
return 0;
break;

arch_mutex_cpu_relax();
}
rcu_read_unlock();

/*
* If the owner changed to another task there is likely
* heavy contention, stop spinning.
* We break out the loop above on need_resched() and when the
* owner changed, which is a sign for heavy contention. Return
* success only when lock->owner is NULL.
*/
if (lock->owner)
return 0;

return 1;
return lock->owner == NULL;
}
#endif

Expand Down

0 comments on commit f146b8d

Please sign in to comment.