[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090427185423.GC23862@elte.hu>
Date: Mon, 27 Apr 2009 20:54:23 +0200
From: Ingo Molnar <mingo@...e.hu>
To: Stephen Hemminger <shemminger@...tta.com>
Cc: Peter Zijlstra <peterz@...radead.org>,
Mathieu Desnoyers <mathieu.desnoyers@...ymtl.ca>,
Eric Dumazet <dada1@...mosbay.com>,
David Miller <davem@...emloft.net>,
Jarek Poplawski <jarkao2@...il.com>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Paul Mackerras <paulus@...ba.org>, paulmck@...ux.vnet.ibm.com,
Evgeniy Polyakov <zbr@...emap.net>, kaber@...sh.net,
jeff.chua.linux@...il.com, laijs@...fujitsu.com,
jengelh@...ozas.de, r000n@...0n.net, linux-kernel@...r.kernel.org,
netfilter-devel@...r.kernel.org, netdev@...r.kernel.org,
benh@...nel.crashing.org
Subject: Re: [PATCH] netfilter: use per-CPU r**ursive lock {XV}
* Stephen Hemminger <shemminger@...tta.com> wrote:
> > non of the linux kernel locking primitives have this -- with the
> > possible exception of the cpu-hotplug lock.
> >
> > What rwlock_t has, is reader bias to the point where you can
> > utterly starve writers, with the side effect that you can obtain
> > multiple read ownerships without causing a deadlock.
>
> But what happens when this side effect disappears?
Then well written code works, badly written code breaks.
> > [...]
> >
> > This is all common and well understood terminology, not
> > something Linus invented just to harras you with.
>
> In Documentation/ ? online ? Where is the definition? The only
> reference I se is indirectly in DocBook/kernel-locking.tmpl.
Sure, see:
http://tinyurl.com/c6fakc
> > Generally speaking we do not condone recursive locking
> > strategies -- and afaik reiserfs (as per the BKL) and the
> > network code (as per abusing rwlock_t unfairness) are the only
> > offenders.
> >
> > Like Linus stated, recursive locking is generally poor taste and
> > indicates you basically gave up on trying to find a proper
> > locking scheme. We should very much work towards getting rid of
> > these abberations instead of adding new ones.
>
> The people complaining about naming never seem to be the ones
> providing workable suggestions or patches.
The thing is, while you now have named your locking primitive
correctly, you are still abusing it by using it recursively.
So it's not 'just about naming'. You should not use read-locks as
recursive locks. It's poor code.
Ingo
--
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