All of lore.kernel.org
 help / color / mirror / Atom feed
From: Manfred Spraul <manfred@colorfullife.com>
To: Mike Galbraith <efault@gmx.de>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Rik van Riel <riel@redhat.com>,
	Davidlohr Bueso <davidlohr.bueso@hp.com>,
	hhuang@redhat.com, Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: [PATCH 0/6] ipc/sem.c: performance improvements, FIFO
Date: Sat, 15 Jun 2013 07:27:16 +0200	[thread overview]
Message-ID: <51BBFB34.20206@colorfullife.com> (raw)
In-Reply-To: <1371236750.5796.54.camel@marge.simpson.net>

On 06/14/2013 09:05 PM, Mike Galbraith wrote:
> 32 of 64 cores DL980 without the -rt killing goto again loop removal I
> showed you.  Unstable, not wonderful throughput.
Unfortunately the -rt approach is defintively unstable:
> @@ -285,9 +274,29 @@ static inline int sem_lock(struct sem_ar
>                  * but have to wait for the global lock to be released.
>                  */
>                 if (unlikely(spin_is_locked(&sma->sem_perm.lock))) {
> -                       spin_unlock(&sem->lock);
> - spin_unlock_wait(&sma->sem_perm.lock);
> -                       goto again;
> +                       spin_lock(&sma->sem_perm.lock);
> +                       if (sma->complex_count)
> +                               goto wait_array;
> +
> +                       /*
> +                        * Acquiring our sem->lock under the global lock
> +                        * forces new complex operations to wait for us
> +                        * to exit our critical section.
> +                        */
> +                       spin_lock(&sem->lock);
> +                       spin_unlock(&sma->sem_perm.lock);

Assume there is one op (semctl(), whatever) that acquires the global 
lock - and a continuous stream of simple ops.
- spin_is_locked() returns true due to the semctl().
- then simple ops will switch to spin_lock(&sma->sem_perm.lock).
- since the spinlock is acquired, the next operation will get true from 
spin_is_locked().

It will stay that way around - as long as there is at least one op 
waiting for sma->sem_perm.lock.
With enough cpus, it will stay like this forever.

--
     Manfred

  reply	other threads:[~2013-06-15  5:27 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-10 17:16 [PATCH 0/6] ipc/sem.c: performance improvements, FIFO Manfred Spraul
2013-06-10 17:16 ` [PATCH 1/6] ipc/util.c, ipc_rcu_alloc: cacheline align allocation Manfred Spraul
2013-06-10 17:16   ` [PATCH 2/6] ipc/sem.c: cacheline align the semaphore structures Manfred Spraul
2013-06-10 17:16     ` [PATCH 3/6] ipc/sem: seperate wait-for-zero and alter tasks into seperate queues Manfred Spraul
2013-06-10 17:16       ` [PATCH 4/6] ipc/sem.c: Always use only one queue for alter operations Manfred Spraul
2013-06-10 17:16         ` [PATCH 5/6] ipc/sem.c: Replace shared sem_otime with per-semaphore value Manfred Spraul
2013-06-10 17:16           ` [PATCH 6/6] ipc/sem.c: Rename try_atomic_semop() to perform_atomic_semop(), docu update Manfred Spraul
2013-06-14 15:38 ` [PATCH 0/6] ipc/sem.c: performance improvements, FIFO Manfred Spraul
2013-06-14 19:05   ` Mike Galbraith
2013-06-15  5:27     ` Manfred Spraul [this message]
2013-06-15  5:48       ` Mike Galbraith
2013-06-15  7:30         ` Mike Galbraith
2013-06-15  8:36           ` Mike Galbraith
2013-06-15 11:10     ` Manfred Spraul
2013-06-15 11:37       ` Mike Galbraith
2013-06-18  6:48       ` Mike Galbraith
2013-06-18  7:14         ` Mike Galbraith
2013-06-19 12:57           ` Mike Galbraith

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=51BBFB34.20206@colorfullife.com \
    --to=manfred@colorfullife.com \
    --cc=akpm@linux-foundation.org \
    --cc=davidlohr.bueso@hp.com \
    --cc=efault@gmx.de \
    --cc=hhuang@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=riel@redhat.com \
    --cc=torvalds@linux-foundation.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.