From: Stephen Hemminger <shemminger@vyatta.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: "David S. Miller" <davem@davemloft.net>,
Linux Netdev List <netdev@vger.kernel.org>
Subject: Re: [PATCH] net: dst_release() cleanup
Date: Mon, 7 Dec 2009 09:17:46 -0800 [thread overview]
Message-ID: <20091207091746.51d8958a@nehalam> (raw)
In-Reply-To: <4B1A4BC5.3050300@gmail.com>
On Sat, 05 Dec 2009 13:02:13 +0100
Eric Dumazet <eric.dumazet@gmail.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@gmail.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.
next prev parent reply other threads:[~2009-12-07 17:17 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 [this message]
2009-12-07 18:12 ` Eric Dumazet
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=20091207091746.51d8958a@nehalam \
--to=shemminger@vyatta.com \
--cc=davem@davemloft.net \
--cc=eric.dumazet@gmail.com \
--cc=netdev@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).