Re: [rfc] "fair" rw spinlocks

From: Thomas Gleixner
Date: Mon Nov 30 2009 - 17:37:49 EST


On Mon, 30 Nov 2009, Linus Torvalds wrote:
> On Mon, 30 Nov 2009, Thomas Gleixner wrote:
> >
> > Yeah, forgot to mention sched.c, but that's solvable
>
> It should be fairly easy to add a few 'spin_lock(&tasklist_lock)' around
> stuff that really depended on exclusion from writers. That should
> _hopefully_ be the rare case.
>
> The biggest problem is that there will almost inevitably be things that
> get missed, and any races exposed by lacking locking will be _very_ hard
> to debug and trigger. So what I'd be worried about is not getting to a
> "practically working" state, but any really subtle cases that nobody
> really hits in practice.

I'm aware of that. The number of places where we read_lock
tasklist_lock is 79 in 36 files right now. That's not a horrible task
to go through them one by one and do a case by case conversion with a
proper changelog. That would only leave the write_lock sites.

We can then either do the rw_lock to spin_lock conversion or keep the
rw_lock which has no readers anymore and behaves like a spinlock for a
transition time so reverts of one of the read_lock -> rcu patches
could be done to debug stuff.

Thanks,

tglx
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/