[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20091130161734.GF21639@wotan.suse.de>
Date: Mon, 30 Nov 2009 17:17:34 +0100
From: Nick Piggin <npiggin@...e.de>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Paul McKenney <paulmck@...ibm.com>
Subject: Re: [rfc] "fair" rw spinlocks
On Mon, Nov 30, 2009 at 08:07:16AM -0800, Linus Torvalds wrote:
>
>
> On Mon, 30 Nov 2009, Nick Piggin wrote:
> >
> > Well the simple thing I tried earlier was a per-cpu array of nesting
> > counter there. It's not _too_ expensive, but it does add another cacheline
> > access and branch there. It seems to work in solving the livelock though.
>
> So how did you do the nesting counter? Afaik, it needs to be something
> like
>
> local_irq_save(flags);
> if (!get_cpu_var(tasklist_counter)++)
> spin_lock(&tasklist_lock);
> local_irq_restore(flags);
>
> on the read_lock side (and the same in reverse on unlock). Which seems
> quite a bit more expensive than what we have now. Especially on UP, but I
> guess you can make it conditional on CONFIG_SMP (but that won't help
> generic kernels).
Ah yes the irq manipulations is going to be fairly expensive :(
Let's see... I was just using local_* ops for the counter, but
that is sadly racy.
Hmm.
--
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