[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090421180225.GA26237@elte.hu>
Date: Tue, 21 Apr 2009 20:02:25 +0200
From: Ingo Molnar <mingo@...e.hu>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Stephen Hemminger <shemminger@...tta.com>,
Paul Mackerras <paulus@...ba.org>, paulmck@...ux.vnet.ibm.com,
Eric Dumazet <dada1@...mosbay.com>,
Evgeniy Polyakov <zbr@...emap.net>,
David Miller <davem@...emloft.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, mathieu.desnoyers@...ymtl.ca
Subject: Re: [PATCH] netfilter: use per-cpu recursive lock (v11)
* Linus Torvalds <torvalds@...ux-foundation.org> wrote:
> PS: Ingo, why do the *_bh() functions in kernel/spinlock.c do
> _both_ a "local_bh_disable()" and a "preempt_disable()"? BH
> disable should disable preemption too, no? Or am I confused? In
> which case we need that in the above rdlock_bh too.
i think there might be (are?) uses of:
spin_lock_bh(&some->lock);
...
spin_unlock(&some->lock);
...
local_bh_enable();
So we have to have two preemption control levels for that, as
there's no knowledge at the spin_lock_bh() place whether it will be
followed by a spin_unlock_bh() [in which case it would be safe to do
SOFTIRQ_OFFSET only] - or by a spin_unlock() + local_bh_enable()
pair..
[ That locking pattrn even makes a certain amount of sense: keep the
lock held for a short amount of time - then weaken locking to bh
context exclusion only. ]
What we could do is an optimization to do a compound increase the
preempt count by SOFTIRQ_OFFSET+1 - instead of a local_bh_disable()
+ preempt_disable()? Symmetrically we could do a compound decrease
in the unlock case.
It might even be called: local_bh_preempt_disable() or so?
Ingo
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists