[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.00.0912072056350.27565@melkinpaasi.cs.helsinki.fi>
Date: Mon, 7 Dec 2009 20:59:00 +0200 (EET)
From: "Ilpo Järvinen" <ilpo.jarvinen@...sinki.fi>
To: Stephen Hemminger <shemminger@...tta.com>
cc: Eric Dumazet <eric.dumazet@...il.com>,
"David S. Miller" <davem@...emloft.net>,
Linux Netdev List <netdev@...r.kernel.org>
Subject: Re: [PATCH] net: dst_release() cleanup
On Mon, 7 Dec 2009, Stephen Hemminger wrote:
> On Sat, 05 Dec 2009 13:02:13 +0100
> Eric Dumazet <eric.dumazet@...il.com> wrote:
>
> > atomic_dec_return() is a full memory barrier, we can omit
> > the smp_mb__before_atomic_dec() call.
> >
> > Signed-off-by: Eric Dumazet <eric.dumazet@...il.com>
> > ---
> > net/core/dst.c | 9 ++-------
> > 1 file changed, 2 insertions(+), 7 deletions(-)
> >
> > diff --git a/net/core/dst.c b/net/core/dst.c
> > index 57bc4d5..cdec1d1 100644
> > --- a/net/core/dst.c
> > +++ b/net/core/dst.c
> > @@ -262,13 +262,8 @@ again:
> >
> > void dst_release(struct dst_entry *dst)
> > {
> > - if (dst) {
> > - int newrefcnt;
> > -
> > - smp_mb__before_atomic_dec();
> > - newrefcnt = atomic_dec_return(&dst->__refcnt);
> > - WARN_ON(newrefcnt < 0);
> > - }
> > + if (dst)
> > + WARN_ON(atomic_dec_return(&dst->__refcnt) < 0);
> > }
> > EXPORT_SYMBOL(dst_release);
>
> I don't like to put actual necessary code in WARN or BUG macro
> args because some embedded type developer is likely to build
> with
>
> #define WARN_ON(x)
>
> to get rid of all warnings.
That's their problem then to fix all relevant places. ...That won't even
compile because of constructs like this:
if (WARN_ON(x))
...To my knowing this perfectly legal way of doing this.
--
i.
--
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