From: Patrick McHardy <kaber@trash.net>
To: netdev@oss.sgi.com
Subject: kfree_skb: unnecessary check ?
Date: Wed, 19 Jun 2002 18:53:18 +0200 [thread overview]
Message-ID: <3D10B6FE.1050602@trash.net> (raw)
Hi everyone.
In skbuff.h one sees:
static inline void kfree_skb(struct sk_buff *skb)
{
if (atomic_read(&skb->users) == 1 ||
atomic_dec_and_test(&skb->users))
__kfree_skb(skb);
}
Is atomic_dec_and_test really necessary ? atomic_dec_and_test only
returns true if its argument has hit zero, so it was 1 before.
If atomic_dec is only a bit cheaper than atomic_dec_and_test (which i
guess it is), wouldn't it make more sense to use something like this:
static inline void kfree_skb(struct sk_buff *skb)
{
if (atomic_read(&skb->users) == 1)
__kfree(skb);
else
atomic_dec(&skb->users);
}
Bye,
Patrick
next reply other threads:[~2002-06-19 16:53 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-06-19 16:53 Patrick McHardy [this message]
2002-06-19 19:51 ` kfree_skb: unnecessary check ? Thomas 'Dent' Mirlacher
2002-06-19 20:26 ` kuznet
2002-06-19 21:32 ` Patrick McHardy
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=3D10B6FE.1050602@trash.net \
--to=kaber@trash.net \
--cc=netdev@oss.sgi.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 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).