Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1246098
| Path | csiph.com!eternal-september.org!feeder.eternal-september.org!news.mixmin.net!weretis.net!feeder1.news.weretis.net!newsfeed.CARNet.hr!news.spin.it!bofh.it!news.nic.it!robomod |
|---|---|
| From | Peter Zijlstra <peterz@infradead.org> |
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v7 4/5] locking/pvqspinlock: Allow 1 lock stealing attempt |
| Date | Tue, 13 Oct 2015 22:00:03 +0200 |
| Message-ID | <qjdTR-8ds-39@gated-at.bofh.it> (permalink) |
| References | <qbCPn-8bs-3@gated-at.bofh.it> <qbCPo-8bs-7@gated-at.bofh.it> |
| X-Original-To | Waiman Long <Waiman.Long@hpe.com> |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| Content-Disposition | inline |
| User-Agent | Mutt/1.5.21 (2012-12-30) |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 52 |
| Organization | linux.* mail to news gateway |
| X-Original-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> |
| X-Original-Date | Tue, 13 Oct 2015 21:56:27 +0200 |
| X-Original-Message-ID | <20151013195627.GY3816@twins.programming.kicks-ass.net> |
| X-Original-References | <1442955044-43895-1-git-send-email-Waiman.Long@hpe.com> <1442955044-43895-5-git-send-email-Waiman.Long@hpe.com> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1246098 |
Show key headers only | View raw
On Tue, Sep 22, 2015 at 04:50:43PM -0400, Waiman Long wrote:
> +gotlock:
> /*
> + * We now have the lock. We need to either clear the tail code or
> + * notify the next one in queue as the new queue head.
> */
> + old = atomic_read(&lock->val);
> + while ((old & _Q_TAIL_MASK) == tail) {
> + int val;
> + int new = old & ~_Q_TAIL_MASK;
> +
> + /*
> + * We are the only one in the queue, so clear the tail code
> + * and return.
> + */
> + val = atomic_cmpxchg(&lock->val, old, new);
> + if (old == val)
> + goto done;
> + old = val;
> + }
> +
This i need to think about a wee bit; its almost the same...
So the below is exactly duplicated from the normal slowpath, so why
don't you keep that there?
It would get you something like:
if (pv_wait_head_or_steal(..))
goto stolen;
stolen:
> + /*
> + * contended path; wait for next, release.
> + */
> + while (!(next = READ_ONCE(node->next)))
> + cpu_relax();
> +
> + arch_mcs_spin_unlock_contended(&next->locked);
> + pv_kick_node(lock, next);
release:
...
--
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/
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
Re: [PATCH v7 4/5] locking/pvqspinlock: Allow 1 lock stealing attempt Peter Zijlstra <peterz@infradead.org> - 2015-10-13 22:00 +0200
Re: [PATCH v7 4/5] locking/pvqspinlock: Allow 1 lock stealing attempt Waiman Long <waiman.long@hpe.com> - 2015-10-13 23:00 +0200
Re: [PATCH v7 4/5] locking/pvqspinlock: Allow 1 lock stealing attempt Peter Zijlstra <peterz@infradead.org> - 2015-10-14 11:30 +0200
Re: [PATCH v7 4/5] locking/pvqspinlock: Allow 1 lock stealing attempt Waiman Long <waiman.long@hpe.com> - 2015-10-15 23:10 +0200
csiph-web