mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Arjan van de Ven <arjan@infradead.org>
To: Bruno Santos <bsantos@av.it.pt>
Cc: linux-kernel@vger.kernel.org, bsantos@av.it.pt
Subject: Re: semaphore: lockless fastpath using atomic_{inc,dec}_return
Date: Wed, 9 Jul 2008 07:16:35 -0700	[thread overview]
Message-ID: <20080709071635.5c5ecc0f@infradead.org> (raw)
In-Reply-To: <4874B979.4020608@av.it.pt>

On Wed, 09 Jul 2008 14:13:29 +0100
Bruno Santos <bsantos@av.it.pt> wrote:

> So far the machine I'm testing this (Core2 Duo) it's been up to
> almost 24H.
> 
> It seems the patch got screwed by the mailer, so I'm posting it again.
> 
> 
>  From 343d08a5d172d103e49c77e5580a45f02fab2b5e Mon Sep 17 00:00:00
> 2001 From: Bruno Santos <bsantos@av.it.pt>
> Date: Tue, 8 Jul 2008 23:40:53 +0100
> Subject: [PATCH] semaphore lockless fastpath
> 
> 
> Signed-off-by: Bruno Santos <bsantos@av.it.pt>
> ---
>  include/linux/semaphore.h |    4 +-
>  kernel/semaphore.c        |  131 
> +++++++++++++++++++++++++--------------------
>  2 files changed, 75 insertions(+), 60 deletions(-)
> 
> diff --git a/include/linux/semaphore.h b/include/linux/semaphore.h
> index 9cae64b..d7850f0 100644
> --- a/include/linux/semaphore.h
> +++ b/include/linux/semaphore.h
> @@ -14,15 +14,15 @@
>  
>  /* Please don't access any members of this structure directly */
>  struct semaphore {
> +    atomic_t        count;
>      spinlock_t        lock;
> -    unsigned int        count;
>      struct list_head    wait_list;
>  };
> 



hi,

not to ruin the party but... how is this lockless? An atomic variable
is every bit a "lock" as a spinlock is... and very much equally
expensive as well for most cases ;-(

  reply	other threads:[~2008-07-09 14:16 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-09 13:13 Bruno Santos
2008-07-09 14:16 ` Arjan van de Ven [this message]
2008-07-09 14:24   ` Christoph Lameter
2008-07-09 15:39 Bruno Santos
2008-07-09 15:50 ` Arjan van de Ven
2008-07-09 16:56   ` Bruno Santos
2008-07-09 19:27     ` Bruno Santos
2008-07-09 20:05     ` Arjan van de Ven

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=20080709071635.5c5ecc0f@infradead.org \
    --to=arjan@infradead.org \
    --cc=bsantos@av.it.pt \
    --cc=linux-kernel@vger.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome