[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20080709071635.5c5ecc0f@infradead.org>
Date: Wed, 9 Jul 2008 07:16:35 -0700
From: Arjan van de Ven <arjan@...radead.org>
To: Bruno Santos <bsantos@...it.pt>
Cc: linux-kernel@...r.kernel.org, bsantos@...it.pt
Subject: Re: semaphore: lockless fastpath using atomic_{inc,dec}_return
On Wed, 09 Jul 2008 14:13:29 +0100
Bruno Santos <bsantos@...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@...it.pt>
> Date: Tue, 8 Jul 2008 23:40:53 +0100
> Subject: [PATCH] semaphore lockless fastpath
>
>
> Signed-off-by: Bruno Santos <bsantos@...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 ;-(
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists