All of lore.kernel.org
 help / color / mirror / Atom feed
From: "George Spelvin" <linux@horizon.com>
To: andi@firstfloor.org, Waiman.Long@hp.com
Cc: akpm@linux-foundation.org, arnd@arndb.de, aswin@hp.com,
	daniel@numascale.com, halcy@yandex.ru, hpa@zytor.com,
	linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux@horizon.com, mingo@redhat.com, paulmck@linux.vnet.ibm.com,
	peterz@infradead.org, raghavendra.kt@linux.vnet.ibm.com,
	riel@redhat.com, rostedt@goodmis.org, scott.norton@hp.com,
	tglx@linutronix.de, thavatchai.makpahibulchoke@hp.com,
	tim.c.chen@linux.intel.com, torvalds@linux-foundation.org,
	walken@google.com, x86@kernel.org
Subject: Re: [PATCH v3 1/2] qspinlock: Introducing a 4-byte queue spinlock implementation
Date: 28 Jan 2014 21:57:40 -0500	[thread overview]
Message-ID: <20140129025740.17866.qmail@science.horizon.com> (raw)
In-Reply-To: <20140129002048.GE11821@two.firstfloor.org>

> So the 1-2 threads case is the standard case on a small
> system, isn't it? This may well cause regressions.

Well, the common case should be uncontended, which is faster.
But yes, testing would be nice.

>> In the extremely unlikely case that all the queue node entries are
>> used up, the current code will fall back to busy spinning without
>> waiting in a queue with warning message.

> Traditionally we had some code which could take thousands
> of locks in rare cases (e.g. all locks in a hash table or all locks of
> a big reader lock) 

Doesn't apply; the question implies a misunderstanding of what's
happening.  The entry is only needed while spinning waiting for
the lock.  Once the lock has been acquired, it may be recycled.

The thread may *hold* thousands of locks; the entries only apply
to locks being *waited for*.

From process context a thread may only be waiting for one at a time.
Additional entries are only needed in case a processor takes an interrupt
while spinning, and the interrupt handler wants to take a lock, too.

If that lock also has to be waited for, and during the wait you take a
nested interrupt or NMI, a third level might happen.

The chances of this being nested more than 4 deep seem sufficiently
minute.

WARNING: multiple messages have this Message-ID (diff)
From: "George Spelvin" <linux@horizon.com>
To: andi@firstfloor.org, Waiman.Long@hp.com
Cc: akpm@linux-foundation.org, arnd@arndb.de, aswin@hp.com,
	daniel@numascale.com, halcy@yandex.ru, hpa@zytor.com,
	linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux@horizon.com, mingo@redhat.com, paulmck@linux.vnet.ibm.com,
	peterz@infradead.org, raghavendra.kt@linux.vnet.ibm.com,
	riel@redhat.com, rostedt@goodmis.org, scott.norton@hp.com,
	tglx@linutronix.de, thavatchai.makpahibulchoke@hp.com,
	tim.c.chen@linux.intel.com, torvalds@linux-foundation.org,
	walken@google.com, x86@kernel.org
Subject: Re: [PATCH v3 1/2] qspinlock: Introducing a 4-byte queue spinlock implementation
Date: 28 Jan 2014 21:57:40 -0500	[thread overview]
Message-ID: <20140129025740.17866.qmail@science.horizon.com> (raw)
In-Reply-To: <20140129002048.GE11821@two.firstfloor.org>

> So the 1-2 threads case is the standard case on a small
> system, isn't it? This may well cause regressions.

Well, the common case should be uncontended, which is faster.
But yes, testing would be nice.

>> In the extremely unlikely case that all the queue node entries are
>> used up, the current code will fall back to busy spinning without
>> waiting in a queue with warning message.

> Traditionally we had some code which could take thousands
> of locks in rare cases (e.g. all locks in a hash table or all locks of
> a big reader lock) 

Doesn't apply; the question implies a misunderstanding of what's
happening.  The entry is only needed while spinning waiting for
the lock.  Once the lock has been acquired, it may be recycled.

The thread may *hold* thousands of locks; the entries only apply
to locks being *waited for*.

>From process context a thread may only be waiting for one at a time.
Additional entries are only needed in case a processor takes an interrupt
while spinning, and the interrupt handler wants to take a lock, too.

If that lock also has to be waited for, and during the wait you take a
nested interrupt or NMI, a third level might happen.

The chances of this being nested more than 4 deep seem sufficiently
minute.

  reply	other threads:[~2014-01-29  2:57 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-28 18:19 [PATCH v3 0/2] qspinlock: Introducing a 4-byte queue spinlock Waiman Long
2014-01-28 18:19 ` [PATCH v3 1/2] qspinlock: Introducing a 4-byte queue spinlock implementation Waiman Long
2014-01-29  0:20   ` Andi Kleen
2014-01-29  0:20     ` Andi Kleen
2014-01-29  2:57     ` George Spelvin [this message]
2014-01-29  2:57       ` George Spelvin
2014-01-29 17:57     ` Waiman Long
2014-01-30 17:43   ` Rik van Riel
2014-01-30 19:00   ` Tim Chen
2014-01-30 19:28     ` Peter Zijlstra
2014-01-30 22:27       ` Tim Chen
2014-01-31 18:26       ` Waiman Long
2014-01-31 19:14         ` George Spelvin
2014-01-31 19:28           ` Waiman Long
2014-01-31 19:45         ` Peter Zijlstra
2014-01-31 18:16     ` Waiman Long
2014-01-30 19:35   ` Peter Zijlstra
2014-01-31 18:28     ` Waiman Long
2014-01-31 15:08   ` Peter Zijlstra
2014-01-31 19:24     ` Waiman Long
2014-01-31 19:51       ` Peter Zijlstra
2014-02-03 11:40       ` Peter Zijlstra
2014-02-06  3:10         ` Waiman Long
2014-02-07 18:17           ` Paul E. McKenney
2014-02-03  8:51   ` Raghavendra K T
2014-01-28 18:19 ` [PATCH v3 2/2] qspinlock, x86: Enable x86-64 to use queue spinlock Waiman Long
2014-01-30 17:45   ` Rik van Riel
2014-01-30  8:55 ` [PATCH v3 0/2] qspinlock: Introducing a 4-byte " Raghavendra K T
2014-01-30 15:38   ` Waiman Long
2014-01-30 18:49     ` Raghavendra K T
2014-02-03  8:51       ` Raghavendra K T
2014-02-06  3:09         ` 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=20140129025740.17866.qmail@science.horizon.com \
    --to=linux@horizon.com \
    --cc=Waiman.Long@hp.com \
    --cc=akpm@linux-foundation.org \
    --cc=andi@firstfloor.org \
    --cc=arnd@arndb.de \
    --cc=aswin@hp.com \
    --cc=daniel@numascale.com \
    --cc=halcy@yandex.ru \
    --cc=hpa@zytor.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=peterz@infradead.org \
    --cc=raghavendra.kt@linux.vnet.ibm.com \
    --cc=riel@redhat.com \
    --cc=rostedt@goodmis.org \
    --cc=scott.norton@hp.com \
    --cc=tglx@linutronix.de \
    --cc=thavatchai.makpahibulchoke@hp.com \
    --cc=tim.c.chen@linux.intel.com \
    --cc=torvalds@linux-foundation.org \
    --cc=walken@google.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.