From: Waiman Long <waiman.long@hpe.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@redhat.com>,
Thomas Gleixner <tglx@linutronix.de>,
"H. Peter Anvin" <hpa@zytor.com>,
x86@kernel.org, linux-kernel@vger.kernel.org,
Scott J Norton <scott.norton@hpe.com>,
Douglas Hatch <doug.hatch@hpe.com>,
Davidlohr Bueso <dave@stgolabs.net>
Subject: Re: [PATCH v7 3/5] locking/pvqspinlock: Collect slowpath lock statistics
Date: Tue, 13 Oct 2015 17:06:17 -0400 [thread overview]
Message-ID: <561D7249.3080103@hpe.com> (raw)
In-Reply-To: <20151013200520.GZ3816@twins.programming.kicks-ass.net>
On 10/13/2015 04:05 PM, Peter Zijlstra wrote:
> On Tue, Sep 22, 2015 at 04:50:42PM -0400, Waiman Long wrote:
>
>> @@ -100,10 +242,13 @@ static struct qspinlock **pv_hash(struct qspinlock *lock, struct pv_node *node)
>> {
>> unsigned long offset, hash = hash_ptr(lock, pv_lock_hash_bits);
>> struct pv_hash_entry *he;
>> + int hopcnt = 0;
>>
>> for_each_hash_entry(he, offset, hash) {
>> + hopcnt++;
>> if (!cmpxchg(&he->lock, NULL, lock)) {
>> WRITE_ONCE(he->node, node);
>> + pvstat_hop(hopcnt);
>> return&he->lock;
>> }
>> }
>> @@ -164,9 +309,10 @@ static void pv_init_node(struct mcs_spinlock *node)
>> static void pv_wait_node(struct mcs_spinlock *node)
>> {
>> struct pv_node *pn = (struct pv_node *)node;
>> + int waitcnt = 0;
>> int loop;
>>
>> - for (;;) {
>> + for (;; waitcnt++) {
>> for (loop = SPIN_THRESHOLD; loop; loop--) {
>> if (READ_ONCE(node->locked))
>> return;
>> @@ -250,6 +401,7 @@ static void pv_wait_head(struct qspinlock *lock, struct mcs_spinlock *node)
>> struct pv_node *pn = (struct pv_node *)node;
>> struct __qspinlock *l = (void *)lock;
>> struct qspinlock **lp = NULL;
>> + int waitcnt = 0;
>> int loop;
>>
>> /*
>> @@ -259,7 +411,7 @@ static void pv_wait_head(struct qspinlock *lock, struct mcs_spinlock *node)
>> if (READ_ONCE(pn->state) == vcpu_hashed)
>> lp = (struct qspinlock **)1;
>>
>> - for (;;) {
>> + for (;; waitcnt++) {
>> for (loop = SPIN_THRESHOLD; loop; loop--) {
>> if (!READ_ONCE(l->locked))
>> return;
> These things are ugly; did you verify that they compile away for the
> !stats case?
The waitcnt was added to track if a vCPU was suspended again without
getting the lock after being kicked. I will double check if it will be
compiled away in the !stat case.
Cheers,
Longman
next prev parent reply other threads:[~2015-10-13 21:06 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-22 20:50 [PATCH v7 0/5] locking/qspinlock: Enhance pvqspinlock performance Waiman Long
2015-09-22 20:50 ` [PATCH v7 1/5] locking/qspinlock: relaxes cmpxchg & xchg ops in native code Waiman Long
2015-10-13 18:02 ` Peter Zijlstra
2015-10-13 20:38 ` Waiman Long
2015-10-13 20:47 ` Peter Zijlstra
2015-10-14 9:39 ` Will Deacon
2015-09-22 20:50 ` [PATCH v7 2/5] locking/pvqspinlock, x86: Optimize PV unlock code path Waiman Long
2015-09-22 20:50 ` [PATCH v7 3/5] locking/pvqspinlock: Collect slowpath lock statistics Waiman Long
2015-10-13 20:05 ` Peter Zijlstra
2015-10-13 21:06 ` Waiman Long [this message]
2015-09-22 20:50 ` [PATCH v7 4/5] locking/pvqspinlock: Allow 1 lock stealing attempt Waiman Long
2015-10-13 18:23 ` Peter Zijlstra
2015-10-13 20:41 ` Waiman Long
2015-10-13 20:44 ` Peter Zijlstra
2015-10-15 20:44 ` Waiman Long
2015-10-13 19:39 ` Peter Zijlstra
2015-10-13 20:45 ` Waiman Long
2015-10-13 19:56 ` Peter Zijlstra
2015-10-13 20:50 ` Waiman Long
2015-10-14 9:28 ` Peter Zijlstra
2015-10-15 21:01 ` Waiman Long
2015-09-22 20:50 ` [PATCH v7 5/5] locking/pvqspinlock: Queue node adaptive spinning Waiman Long
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=561D7249.3080103@hpe.com \
--to=waiman.long@hpe.com \
--cc=dave@stgolabs.net \
--cc=doug.hatch@hpe.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=scott.norton@hpe.com \
--cc=tglx@linutronix.de \
--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
Powered by JetHome