Messages in this thread Patch in this message | | | Subject | Re: [PATCH 1/1] mutex: prevent optimistic spinning from spinning longer than neccessary (Repost) | From | Tim Chen <> | Date | Fri, 20 Aug 2010 09:54:35 -0700 |
| |
On Fri, 2010-08-20 at 15:19 +0200, Ingo Molnar wrote:
> > Thanks! The performance results you've posted so far IMO more than justifies > its inclusion. > > Ingo
Thanks to everyone for your review. I've updated the patch to add comments explaining the change per suggestion from Andrew.
Signed-off-by: Tim Chen <tim.c.chen@linux.intel.com> diff --git a/kernel/sched.c b/kernel/sched.c index 41541d7..3747d04 100644 --- a/kernel/sched.c +++ b/kernel/sched.c @@ -3865,8 +3865,15 @@ int mutex_spin_on_owner(struct mutex *lock, struct thread_info *owner) /* * Owner changed, break to re-assess state. */ - if (lock->owner != owner) + if (lock->owner != owner) { + /* if lock has switched to a different owner, + * we have heavy contention. Return 0 to + * quit optimistic spinning and not contend further. + */ + if (lock->owner) + return 0; break; + } /* * Is that owner really running on that cpu?
| |