From: Eric Dumazet <eric.dumazet@gmail.com>
To: Stephen Hemminger <shemminger@vyatta.com>
Cc: "David S. Miller" <davem@davemloft.net>,
Linux Netdev List <netdev@vger.kernel.org>
Subject: Re: [PATCH] net: dst_release() cleanup
Date: Mon, 07 Dec 2009 19:12:03 +0100 [thread overview]
Message-ID: <4B1D4573.9040605@gmail.com> (raw)
In-Reply-To: <20091207091746.51d8958a@nehalam>
Stephen Hemminger a écrit :
> 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.
Oops, I thought WARN_ON(X) must evaluate X once, my bad, since its not documented.
Thanks
[PATCH] net: dst_release() cleanup
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@gmail.com>
---
diff --git a/net/core/dst.c b/net/core/dst.c
index 57bc4d5..c3d0cfa 100644
--- a/net/core/dst.c
+++ b/net/core/dst.c
@@ -263,11 +263,9 @@ again:
void dst_release(struct dst_entry *dst)
{
if (dst) {
- int newrefcnt;
+ int newrefcnt = atomic_dec_return(&dst->__refcnt);
- smp_mb__before_atomic_dec();
- newrefcnt = atomic_dec_return(&dst->__refcnt);
- WARN_ON(newrefcnt < 0);
+ WARN_ON(newrefcnt < 0);
}
}
EXPORT_SYMBOL(dst_release);
next prev parent reply other threads:[~2009-12-07 18:12 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-05 12:02 [PATCH] net: dst_release() cleanup Eric Dumazet
2009-12-07 17:17 ` Stephen Hemminger
2009-12-07 18:12 ` Eric Dumazet [this message]
2009-12-07 18:57 ` Stephen Hemminger
2009-12-07 18:59 ` Ilpo Järvinen
2009-12-07 19:13 ` Eric Dumazet
2009-12-09 4:35 ` David Miller
2009-12-09 21:46 ` Eric Dumazet
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4B1D4573.9040605@gmail.com \
--to=eric.dumazet@gmail.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=shemminger@vyatta.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.