[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200122085816.GB15537@willie-the-truck>
Date: Wed, 22 Jan 2020 08:58:17 +0000
From: Will Deacon <will@...nel.org>
To: Peter Zijlstra <peterz@...radead.org>
Cc: Alex Kogan <alex.kogan@...cle.com>, linux-arch@...r.kernel.org,
guohanjun@...wei.com, arnd@...db.de, dave.dice@...cle.com,
jglauber@...vell.com, x86@...nel.org, will.deacon@....com,
linux@...linux.org.uk, steven.sistare@...cle.com,
linux-kernel@...r.kernel.org, rahul.x.yadav@...cle.com,
mingo@...hat.com, bp@...en8.de, hpa@...or.com, longman@...hat.com,
tglx@...utronix.de, daniel.m.jordan@...cle.com,
linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCH v7 3/5] locking/qspinlock: Introduce CNA into the slow
path of qspinlock
On Tue, Jan 21, 2020 at 09:29:19PM +0100, Peter Zijlstra wrote:
>
> various notes and changes in the below.
>
> ---
>
> Index: linux-2.6/kernel/locking/qspinlock.c
> ===================================================================
> --- linux-2.6.orig/kernel/locking/qspinlock.c
> +++ linux-2.6/kernel/locking/qspinlock.c
> @@ -598,10 +598,10 @@ EXPORT_SYMBOL(queued_spin_lock_slowpath)
> #define _GEN_CNA_LOCK_SLOWPATH
>
> #undef pv_wait_head_or_lock
> -#define pv_wait_head_or_lock cna_pre_scan
> +#define pv_wait_head_or_lock cna_wait_head_or_lock
>
> #undef try_clear_tail
> -#define try_clear_tail cna_try_change_tail
> +#define try_clear_tail cna_try_clear_tail
>
> #undef mcs_pass_lock
> #define mcs_pass_lock cna_pass_lock
> Index: linux-2.6/kernel/locking/qspinlock_cna.h
> ===================================================================
> --- linux-2.6.orig/kernel/locking/qspinlock_cna.h
> +++ linux-2.6/kernel/locking/qspinlock_cna.h
> @@ -8,37 +8,37 @@
> /*
> * Implement a NUMA-aware version of MCS (aka CNA, or compact NUMA-aware lock).
> *
> - * In CNA, spinning threads are organized in two queues, a main queue for
> + * In CNA, spinning threads are organized in two queues, a primary queue for
> * threads running on the same NUMA node as the current lock holder, and a
> - * secondary queue for threads running on other nodes. Schematically, it
> - * looks like this:
> + * secondary queue for threads running on other nodes. Schematically, it looks
> + * like this:
> *
> * cna_node
> - * +----------+ +--------+ +--------+
> - * |mcs:next | -> |mcs:next| -> ... |mcs:next| -> NULL [Main queue]
> - * |mcs:locked| -+ +--------+ +--------+
> + * +----------+ +--------+ +--------+
> + * |mcs:next | --> |mcs:next| --> ... |mcs:next| --> NULL [Primary queue]
> + * |mcs:locked| -. +--------+ +--------+
> * +----------+ |
> - * +----------------------+
> - * \/
> + * `----------------------.
> + * v
> * +--------+ +--------+
> - * |mcs:next| -> ... |mcs:next| [Secondary queue]
> + * |mcs:next| --> ... |mcs:next| [Secondary queue]
> * +--------+ +--------+
> * ^ |
> - * +--------------------+
> + * `--------------------'
> *
> - * N.B. locked = 1 if secondary queue is absent. Othewrise, it contains the
> + * N.B. locked := 1 if secondary queue is absent. Othewrise, it contains the
If we're redoing the comment, please can you s/Othewrise/Otherwise/ at the
same time? It catches me every time I read it!
Will
Powered by blists - more mailing lists