From: Jeff Garzik <jgarzik@pobox.com>
To: "David S. Miller" <davem@redhat.com>
Cc: benh@kernel.crashing.org, linux-kernel@vger.kernel.org,
Netdev <netdev@oss.sgi.com>
Subject: Re: Problem with dev_kfree_skb_any() in 2.6.0
Date: Tue, 30 Dec 2003 12:43:21 -0500 [thread overview]
Message-ID: <3FF1B939.1090108@pobox.com> (raw)
In-Reply-To: <20031229221345.31c8c763.davem@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 2066 bytes --]
David S. Miller wrote:
> On Tue, 30 Dec 2003 01:12:21 -0500
> Jeff Garzik <jgarzik@pobox.com> wrote:
>
>
>>Think about the name of this function: dev_kfree_skb_any()
>>
>>If this function cannot be used -anywhere-, then the concept (and the
>>net stack) is fundamentally broken for this function. We must _remove_
>>the function, and thus _I_ have a lot of driver work to do.
>
>
> If it makes you happy, change the suffix of the name, I am
> not emotionally attached to the name.
It's not about the name itself. _Think_ about the name: what is the
purpose of the function? what does it imply? How have kernel hackers
used it in practice? I think you're focusing too closely on
implementation, rather than purpose.
I humbly request that we expend some brain CPU cycles to think about the
API here.
To review:
* The base requirement is that __kfree_skb shall not call the skb's
destructor in hard IRQ context.
* To that end, dev_kfree_skb_irq was created to queue skb's for
__kfree_skb'ing, when that requirement is not immediately satisfied.
* dev_kfree_skb_any was created for situations that either don't know,
or don't care, about the context in which skb's are freed. The function
name and implementation are less relevant than _purpose_.
As it stands now, dev_kfree_skb_any() does not serve the purpose for
which it is used in many drivers (not just the short list found in this
thread).
Luckily, I feel there is an easy solution, as shown in the attached
patch. We _already_ queue skbs in dev_kfree_skb_irq(). Therefore,
dev_kfree_skb_any() can simply use precisely that same solution. The
raise-softirq code will immediately proceed to action if we are not in
hard IRQ context, otherwise it will follow the expected path.
As an aside (tangent warning), we will need to consider further
queueing, if we are to follow the rest of the kernel: skb destructor
should really be in purely task context, i.e. make sure __kfree_skb does
its work in kernel thread context. But that's a discussion for another
day ;-)
Jeff
[-- Attachment #2: patch --]
[-- Type: text/plain, Size: 392 bytes --]
===== include/linux/netdevice.h 1.66 vs edited =====
--- 1.66/include/linux/netdevice.h Sat Nov 1 17:11:04 2003
+++ edited/include/linux/netdevice.h Tue Dec 30 12:29:40 2003
@@ -634,10 +634,7 @@
*/
static inline void dev_kfree_skb_any(struct sk_buff *skb)
{
- if (in_irq())
- dev_kfree_skb_irq(skb);
- else
- dev_kfree_skb(skb);
+ dev_kfree_skb_irq(skb);
}
#define HAVE_NETIF_RX 1
next prev parent reply other threads:[~2003-12-30 17:43 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-12-27 23:17 Problem with dev_kfree_skb_any() in 2.6.0 Benjamin Herrenschmidt
2003-12-28 1:07 ` David S. Miller
2003-12-28 5:44 ` Benjamin Herrenschmidt
2003-12-30 4:09 ` Jeff Garzik
2003-12-30 4:51 ` David S. Miller
2003-12-30 5:15 ` Jeff Garzik
2003-12-30 6:01 ` David S. Miller
2003-12-30 6:12 ` Jeff Garzik
2003-12-30 6:13 ` David S. Miller
2003-12-30 17:43 ` Jeff Garzik [this message]
2004-01-01 20:42 ` David S. Miller
2004-01-02 2:58 ` Jeff Garzik
2004-01-06 3:54 ` David S. Miller
2003-12-30 6:14 ` Benjamin Herrenschmidt
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=3FF1B939.1090108@pobox.com \
--to=jgarzik@pobox.com \
--cc=benh@kernel.crashing.org \
--cc=davem@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--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