Re: [PATCH 3/7] [NET]: uninline dev_alloc_skb, de-bloats a lot

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Denys Vlasenko
Date: Thursday, March 27, 2008 - 4:36 pm

On Thursday 27 March 2008 13:38, Ilpo Järvinen wrote:


This will be very confusing for casual reader:


"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
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 1/7] [NET]: uninline skb_put, de-bloats a lot, Ilpo Järvinen, (Thu Mar 27, 5:38 am)
[PATCH 2/7] [NET]: uninline skb_pull, de-bloats a lot, Ilpo Järvinen, (Thu Mar 27, 5:38 am)
[PATCH 3/7] [NET]: uninline dev_alloc_skb, de-bloats a lot, Ilpo Järvinen, (Thu Mar 27, 5:38 am)
[PATCH 4/7] [NET]: uninline skb_push, de-bloats a lot, Ilpo Järvinen, (Thu Mar 27, 5:38 am)
[PATCH 5/7] [NET]: uninline dst_release, Ilpo Järvinen, (Thu Mar 27, 5:38 am)
[PATCH 6/7] [NET]: uninline skb_trim, de-bloats, Ilpo Järvinen, (Thu Mar 27, 5:38 am)
[PATCH 7/7] [SCTP]: Remove sctp_add_cmd_sf wrapper bloat, Ilpo Järvinen, (Thu Mar 27, 5:38 am)
Re: [PATCH 3/7] [NET]: uninline dev_alloc_skb, de-bloats a lot, Denys Vlasenko, (Thu Mar 27, 4:36 pm)
Re: [PATCH 5/7] [NET]: uninline dst_release, David Miller, (Thu Mar 27, 5:53 pm)
Re: [PATCH 6/7] [NET]: uninline skb_trim, de-bloats, David Miller, (Thu Mar 27, 5:54 pm)
Re: [PATCH 3/7] [NET]: uninline dev_alloc_skb, de-bloats a lot, Arnaldo Carvalho de Melo, (Thu Mar 27, 6:42 pm)
Re: [PATCH 1/7] [NET]: uninline skb_put, de-bloats a lot, Ilpo Järvinen, (Fri Mar 28, 12:56 pm)