From: Waiman Long <Waiman.Long@hp.com>
To: Ingo Molnar <mingo@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
David Howells <dhowells@redhat.com>,
Dave Jones <davej@redhat.com>,
Clark Williams <williams@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
linux-kernel@vger.kernel.org, x86@kernel.org,
linux-arch@vger.kernel.org, "Chandramouleeswaran,
Aswin" <aswin@hp.com>, Davidlohr Bueso <davidlohr.bueso@hp.com>,
"Norton, Scott J" <scott.norton@hp.com>,
Rik van Riel <riel@redhat.com>
Subject: Re: [PATCH v2 2/3] mutex: Queue mutex spinners with MCS lock to reduce cacheline contention
Date: Tue, 16 Apr 2013 10:26:31 -0400 [thread overview]
Message-ID: <516D5F97.9050203@hp.com> (raw)
In-Reply-To: <20130416091026.GB9569@gmail.com>
On 04/16/2013 05:10 AM, Ingo Molnar wrote:
> * Waiman Long<Waiman.Long@hp.com> wrote:
>
>> --- a/kernel/sched/core.c
>> +++ b/kernel/sched/core.c
>> @@ -3021,9 +3021,6 @@ static inline bool owner_running(struct mutex *lock, struct task_struct *owner)
>> */
>> 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())
>> @@ -3040,6 +3037,27 @@ int mutex_spin_on_owner(struct mutex *lock, struct task_struct *owner)
>> */
>> return lock->owner == NULL;
>> }
>> +
>> +/*
>> + * Initial check for entering the mutex spinning loop
>> + */
>> +int mutex_can_spin_on_owner(struct mutex *lock)
>> +{
>> + int retval = 1;
>> +
>> + if (!sched_feat(OWNER_SPIN))
>> + return 0;
>> +
>> + rcu_read_lock();
>> + if (lock->owner)
>> + retval = lock->owner->on_cpu;
>> + rcu_read_unlock();
>> + /*
>> + * if lock->owner is not set, the mutex owner may have just acquired
>> + * it and not set the owner yet or the mutex has been released.
>> + */
>> + return retval;
>> +}
> The SCHED_FEAT_OWNER_SPIN was really just an early hack we did to make
> with/without mutex-spinning testable.
I see.
> I'd suggest a preparatory patch that gets rid of that flag and moves these two
> functions from sched/core.c to mutex.c where they belong.
>
> This will also allow the removal of the mutex prototypes from sched.h.
Yes, I can certainly prepare a patch to remove SCHED_FEAT_OWNER_SPIN &
move those functions back to mutex.c after my patch set goes in. As for
the timing, do you want me to do it now or it can wait as I will start
my vacation later this week and will be back by the end of the month.
Regards,
Longman
next prev parent reply other threads:[~2013-04-16 14:26 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-15 14:37 [PATCH 0/3 v2] mutex: Improve mutex performance by doing less atomic-ops & better spinning Waiman Long
2013-04-15 14:37 ` [PATCH v2 1/3] mutex: Make more scalable by doing less atomic operations Waiman Long
2013-04-15 14:45 ` Rik van Riel
2013-04-15 14:37 ` [PATCH v2 2/3] mutex: Queue mutex spinners with MCS lock to reduce cacheline contention Waiman Long
2013-04-15 14:37 ` Waiman Long
2013-04-15 16:27 ` Rik van Riel
2013-04-16 4:24 ` Davidlohr Bueso
2013-04-16 12:05 ` Waiman Long
2013-04-16 9:10 ` Ingo Molnar
2013-04-16 14:26 ` Waiman Long [this message]
2013-04-17 7:50 ` Ingo Molnar
2013-04-17 7:50 ` Ingo Molnar
2013-04-15 14:37 ` [PATCH v2 optional 3/3] mutex: back out architecture specific check for negative mutex count Waiman Long
2013-04-15 14:37 ` Waiman Long
2013-04-16 10:05 ` Will Deacon
2013-04-16 12:10 ` Waiman Long
2013-04-16 9:12 ` [PATCH 0/3 v2] mutex: Improve mutex performance by doing less atomic-ops & better spinning Ingo Molnar
2013-04-16 9:12 ` Ingo Molnar
2013-04-16 11:49 ` Waiman Long
2013-04-16 13:09 ` Ingo Molnar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=516D5F97.9050203@hp.com \
--to=waiman.long@hp.com \
--cc=aswin@hp.com \
--cc=davej@redhat.com \
--cc=davidlohr.bueso@hp.com \
--cc=dhowells@redhat.com \
--cc=hpa@zytor.com \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=mingo@redhat.com \
--cc=paulmck@linux.vnet.ibm.com \
--cc=peterz@infradead.org \
--cc=riel@redhat.com \
--cc=scott.norton@hp.com \
--cc=tglx@linutronix.de \
--cc=williams@redhat.com \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).