public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* 800+ byte inlines in include/net/pkt_act.h
@ 2006-08-20 17:33 Denis Vlasenko
  2006-08-21 12:26 ` jamal
  0 siblings, 1 reply; 4+ messages in thread
From: Denis Vlasenko @ 2006-08-20 17:33 UTC (permalink / raw)
  To: linux-kernel, netdev

Hi,

include/net/pkt_act.h plays a game of inlines
which are kind of "templatized", like this:

act_ipt.c:

/* ovewrride the defaults */
#define tcf_st          tcf_ipt
#define tcf_t_lock      ipt_lock
#define tcf_ht          tcf_ipt_ht
#define CONFIG_NET_ACT_INIT
#include <net/pkt_act.h>

This results in code duplication. For example,
tcf_generic_walker() is duplicated four times.
On i386 it is about 4*800 bytes in text section.
Other inlines are a bit smaller but still are substantial.
--
vda

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: 800+ byte inlines in include/net/pkt_act.h
  2006-08-20 17:33 800+ byte inlines in include/net/pkt_act.h Denis Vlasenko
@ 2006-08-21 12:26 ` jamal
  2006-08-21 23:38   ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: jamal @ 2006-08-21 12:26 UTC (permalink / raw)
  To: Denis Vlasenko; +Cc: linux-kernel, netdev

On Sun, 2006-20-08 at 19:33 +0200, Denis Vlasenko wrote:
> Hi,
> 
> include/net/pkt_act.h plays a game of inlines
> which are kind of "templatized", like this:
> 
> act_ipt.c:
> 
> /* ovewrride the defaults */
> #define tcf_st          tcf_ipt
> #define tcf_t_lock      ipt_lock
> #define tcf_ht          tcf_ipt_ht
> #define CONFIG_NET_ACT_INIT
> #include <net/pkt_act.h>
> 
> This results in code duplication. For example,
> tcf_generic_walker() is duplicated four times.
> On i386 it is about 4*800 bytes in text section.
> Other inlines are a bit smaller but still are substantial.

As per last discussion, either Patrick McHardy or myself are going to
work on it - at some point. Please be patient. The other alternative is:
you fix it and send patches. 

Note that even after conversion, functions like tcf_generic_walker() are
not going to save much in total .text sizes; also note they run the
control path and are typically not as much invoked and therefore not
performance impacting on smaller cache systems..

cheers,
jamal


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: 800+ byte inlines in include/net/pkt_act.h
  2006-08-21 12:26 ` jamal
@ 2006-08-21 23:38   ` David Miller
  2006-08-22 13:45     ` jamal
  0 siblings, 1 reply; 4+ messages in thread
From: David Miller @ 2006-08-21 23:38 UTC (permalink / raw)
  To: hadi; +Cc: vda.linux, linux-kernel, netdev

From: jamal <hadi@cyberus.ca>
Date: Mon, 21 Aug 2006 08:26:00 -0400

> As per last discussion, either Patrick McHardy or myself are going
> to work on it - at some point. Please be patient. The other
> alternative is: you fix it and send patches.

I'm working on it right now.  This code is really gross and needs
to be fixed immediately.

What I'll do is define a "struct tcf_common" and have the generic
interfaces take that as well as a "struct tcf_hashinfo *" parameter to
deal with the individual hash tables.

We define all of this templated stuff then don't even use it in
act_police.c, we just duplicate everything!

Absolutely unbelievable.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: 800+ byte inlines in include/net/pkt_act.h
  2006-08-21 23:38   ` David Miller
@ 2006-08-22 13:45     ` jamal
  0 siblings, 0 replies; 4+ messages in thread
From: jamal @ 2006-08-22 13:45 UTC (permalink / raw)
  To: David Miller; +Cc: vda.linux, linux-kernel, netdev

On Mon, 2006-21-08 at 16:38 -0700, David Miller wrote:
> From: jamal <hadi@cyberus.ca>
> Date: Mon, 21 Aug 2006 08:26:00 -0400
> 
> > As per last discussion, either Patrick McHardy or myself are going
> > to work on it - at some point. Please be patient. The other
> > alternative is: you fix it and send patches.
> 
> I'm working on it right now.  This code is really gross and needs
> to be fixed immediately.
> 
> What I'll do is define a "struct tcf_common" and have the generic
> interfaces take that as well as a "struct tcf_hashinfo *" parameter to
> deal with the individual hash tables.
> 

Sounds reasonable. May actually be close to what Patrick and I had in
discussion (I cant find my notes) i.e hashinfo would contain
table{size,index,mask,lock, and pointer to table}
After staring at the code for a minute, I think the challenges you may
face are in the conversions of: tcf_ {dump_walker(), del_walker() and
generic_walker()}

Thanks for taking this up Dave. And if you get it started and get
distracted somewhere, I could take it over.

> We define all of this templated stuff then don't even use it in
> act_police.c, we just duplicate everything!

act_police deviates from the generic layout; the intent is to allow for
that. The desire was/is for usability for whoever uses the generic
layout (read: joe-netfilter) could write a single page of code quickly
to do something powerful (like gact for example). It is turning out code
augmentation is not such a practical idea in the kernel.

cheers,
jamal

> Absolutely unbelievable.
> -
> 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
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-08-22 13:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-20 17:33 800+ byte inlines in include/net/pkt_act.h Denis Vlasenko
2006-08-21 12:26 ` jamal
2006-08-21 23:38   ` David Miller
2006-08-22 13:45     ` jamal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox