Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1246099 > unrolled thread
| Started by | Peter Zijlstra <peterz@infradead.org> |
|---|---|
| First post | 2015-10-13 22:10 +0200 |
| Last post | 2015-10-13 23:10 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [PATCH v7 3/5] locking/pvqspinlock: Collect slowpath lock statistics Peter Zijlstra <peterz@infradead.org> - 2015-10-13 22:10 +0200
Re: [PATCH v7 3/5] locking/pvqspinlock: Collect slowpath lock statistics Waiman Long <waiman.long@hpe.com> - 2015-10-13 23:10 +0200
| From | Peter Zijlstra <peterz@infradead.org> |
|---|---|
| Date | 2015-10-13 22:10 +0200 |
| Subject | Re: [PATCH v7 3/5] locking/pvqspinlock: Collect slowpath lock statistics |
| Message-ID | <qje3v-cv-3@gated-at.bofh.it> |
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?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | Waiman Long <waiman.long@hpe.com> |
|---|---|
| Date | 2015-10-13 23:10 +0200 |
| Subject | Re: [PATCH v7 3/5] locking/pvqspinlock: Collect slowpath lock statistics |
| Message-ID | <qjeZA-1zx-19@gated-at.bofh.it> |
| In reply to | #1246099 |
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web