From: Denys Vlasenko <vda.linux@googlemail.com>
To: "Ilpo Järvinen" <ilpo.jarvinen@helsinki.fi>
Cc: Andrew Morton <akpm@linux-foundation.org>,
David Miller <davem@davemloft.net>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: Re: [PATCH 3/7] [NET]: uninline dev_alloc_skb, de-bloats a lot
Date: Fri, 28 Mar 2008 00:36:59 +0100 [thread overview]
Message-ID: <200803280036.59311.vda.linux@googlemail.com> (raw)
In-Reply-To: <1206621486-5408-4-git-send-email-ilpo.jarvinen@helsinki.fi>
On Thursday 27 March 2008 13:38, Ilpo Järvinen wrote:
> Allyesconfig (v2.6.24-mm1):
>
> -23668 392 funcs, 104 +, 23772 -, diff: -23668 --- dev_alloc_skb
>
> Without many debug CONFIGs (v2.6.25-rc2-mm1):
>
> -12178 382 funcs, 157 +, 12335 -, diff: -12178 --- dev_alloc_skb
> dev_alloc_skb | +37
This will be very confusing for casual reader:
> +struct sk_buff *dev_alloc_skb(unsigned int length)
> +{
> + return __dev_alloc_skb(length, GFP_ATOMIC);
> +}
> +EXPORT_SYMBOL(dev_alloc_skb);
"what, they want to save one push instruction per callsite??".
Can you add a comment which explains the intent?
+struct sk_buff *dev_alloc_skb(unsigned int length)
+{
+ /* There is more code here than it seems:
+ * __dev_alloc_skb is an inline */
+ return __dev_alloc_skb(length, GFP_ATOMIC);
+}
+EXPORT_SYMBOL(dev_alloc_skb);
Another good chunk of code size saving can be achieved
by introducing dev_alloc_skb_or_warn(), and using it
in places like these:
drivers/net/irda/nsc-ircc.c:
skb = dev_alloc_skb(len+1);
if (skb == NULL) {
IRDA_WARNING("%s(), memory squeeze, "
"dropping frame.\n",
__FUNCTION__);
drivers/net/appletalk/ltpc.c:
skb = dev_alloc_skb(3+sklen);
if (skb == NULL)
{
printk("%s: dropping packet due to memory squeeze.\n",
net/econet/af_econet.c:
newskb = alloc_skb((len - sizeof(struct aunhdr) + 15) & ~15,
GFP_ATOMIC);
if (newskb == NULL)
{
printk(KERN_DEBUG "AUN: memory squeeze, dropping packet.\n");
/* Send nack and hope sender tries again */
goto bad;
}
(hmm, this last one also wants s/alloc_skb(GFP_ATOMIC)/dev_alloc_skb/)
--
vda
next prev parent reply other threads:[~2008-03-27 23:36 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-27 12:37 [PATCH 0/7]: uninline some net related static inline in .h bloaters Ilpo Järvinen
2008-03-27 12:38 ` [PATCH 1/7] [NET]: uninline skb_put, de-bloats a lot Ilpo Järvinen
2008-03-27 12:38 ` [PATCH 2/7] [NET]: uninline skb_pull, " Ilpo Järvinen
2008-03-27 12:38 ` [PATCH 3/7] [NET]: uninline dev_alloc_skb, " Ilpo Järvinen
2008-03-27 12:38 ` [PATCH 4/7] [NET]: uninline skb_push, " Ilpo Järvinen
2008-03-27 12:38 ` [PATCH 5/7] [NET]: uninline dst_release Ilpo Järvinen
2008-03-27 12:38 ` [PATCH 6/7] [NET]: uninline skb_trim, de-bloats Ilpo Järvinen
2008-03-27 12:38 ` [PATCH 7/7] [SCTP]: Remove sctp_add_cmd_sf wrapper bloat Ilpo Järvinen
2008-03-28 0:54 ` David Miller
2008-03-28 0:54 ` [PATCH 6/7] [NET]: uninline skb_trim, de-bloats David Miller
2008-03-28 0:53 ` [PATCH 5/7] [NET]: uninline dst_release David Miller
2008-03-28 0:52 ` [PATCH 4/7] [NET]: uninline skb_push, de-bloats a lot David Miller
2008-03-27 23:36 ` Denys Vlasenko [this message]
2008-03-28 0:52 ` [PATCH 3/7] [NET]: uninline dev_alloc_skb, " David Miller
2008-03-28 1:42 ` Arnaldo Carvalho de Melo
2008-03-28 22:34 ` Denys Vlasenko
2008-03-28 22:57 ` David Miller
2008-03-29 4:52 ` Bill Fink
2008-03-28 0:51 ` David Miller
2008-03-27 19:10 ` [PATCH 1/7] [NET]: uninline skb_put, " Joe Perches
2008-03-27 22:04 ` David Miller
2008-03-28 0:02 ` Joe Perches
2008-03-28 0:04 ` David Miller
2008-03-28 0:11 ` Matt Mackall
2008-03-28 0:54 ` Joe Perches
2008-03-28 1:18 ` Matt Mackall
2008-03-28 19:56 ` Ilpo Järvinen
2008-03-28 0:43 ` David Miller
2008-03-28 0:54 ` [PATCH 0/7]: uninline some net related static inline in .h bloaters David Miller
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=200803280036.59311.vda.linux@googlemail.com \
--to=vda.linux@googlemail.com \
--cc=acme@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=davem@davemloft.net \
--cc=ilpo.jarvinen@helsinki.fi \
--cc=linux-kernel@vger.kernel.org \
--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).