[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150924025435.GB27355@gondor.apana.org.au>
Date: Thu, 24 Sep 2015 10:54:36 +0800
From: Herbert Xu <herbert@...dor.apana.org.au>
To: Tejun Heo <tj@...nel.org>
Cc: David Miller <davem@...emloft.net>, cwang@...pensource.com,
tom@...bertland.com, kafai@...com, kernel-team@...com,
linux-kernel@...r.kernel.org, netdev@...r.kernel.org,
torvalds@...ux-foundation.org, jiri@...nulli.us,
nicolas.dichtel@...nd.com, tgraf@...g.ch, sfeldma@...il.com
Subject: Re: [PATCH v2] netlink: Replace rhash_portid with bound
On Wed, Sep 23, 2015 at 10:46:08PM -0400, Tejun Heo wrote:
>
> Hmm... It looks like I'm failing at communicating. Lemme try again.
> There are two situations where we do this.
>
> 1. When there are different locking contexts. In this case, the write
> path is. It's already protected by the spinlock so the barrier
> isn't necessary.
>
> 2. When the path is hot enough for the cost of smp_rmb() to matter and
> the specifics of individual deref allows for micro optimization and
> justifies the added overhead in terms of increased fragility,
> complexity and need for documentation.
>
> In both cases, we want to make reasonable trade-offs like any other
> choices we make. We don't go off and run to one extreme or the other
> just because barriers are involved. One good measure to use is
> whether the extra documentation necessary is justifiable. In this
> case, on each unprotected derefs, we want to explain why the
> unprotected deref is okay and justified.
What I am concerned about is the next guy who comes along and
does a rewrite like the one that introduced the netlink_bind
bug. That person needs to fully understand what each primitive
is protecting against.
Using primitives where they're not needed can lead to misunderstandings
which may end up causing bugs.
Honestly I don't care whether you have a barrier there or not as
I only use x86. But you very much should add a comment at least
saying that the barrier isn't needed for the cases where I left it
out so that future developers don't get confused.
Cheers,
--
Email: Herbert Xu <herbert@...dor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
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