netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] netdevice.h: Align struct netdevices members
@ 2011-05-10  3:42 Joe Perches
  2011-05-10  3:53 ` Eric Dumazet
  2011-05-13 18:07 ` David Miller
  0 siblings, 2 replies; 7+ messages in thread
From: Joe Perches @ 2011-05-10  3:42 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

Save a bit of space.

Signed-off-by: Joe Perches <joe@perches.com>
---
 include/linux/netdevice.h |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index d5de66a..0fcb86b 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -1020,9 +1020,6 @@ struct net_device {
 	 *	part of the usual set specified in Space.c.
 	 */
 
-	unsigned char		if_port;	/* Selectable AUI, TP,..*/
-	unsigned char		dma;		/* DMA channel		*/
-
 	unsigned long		state;
 
 	struct list_head	dev_list;
@@ -1141,13 +1138,16 @@ struct net_device {
 	const struct header_ops *header_ops;
 
 	unsigned int		flags;	/* interface flags (a la BSD)	*/
+	unsigned int		priv_flags; /* Like 'flags' but invisible to userspace. */
 	unsigned short		gflags;
-        unsigned int            priv_flags; /* Like 'flags' but invisible to userspace. */
 	unsigned short		padded;	/* How much padding added by alloc_netdev() */
 
 	unsigned char		operstate; /* RFC2863 operstate */
 	unsigned char		link_mode; /* mapping policy to operstate */
 
+	unsigned char		if_port;	/* Selectable AUI, TP,..*/
+	unsigned char		dma;		/* DMA channel		*/
+
 	unsigned int		mtu;	/* interface MTU value		*/
 	unsigned short		type;	/* interface hardware type	*/
 	unsigned short		hard_header_len;	/* hardware hdr length	*/



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

* Re: [PATCH net-next] netdevice.h: Align struct netdevices members
  2011-05-10  3:42 [PATCH net-next] netdevice.h: Align struct netdevices members Joe Perches
@ 2011-05-10  3:53 ` Eric Dumazet
  2011-05-10  4:22   ` Joe Perches
  2011-05-13 18:07 ` David Miller
  1 sibling, 1 reply; 7+ messages in thread
From: Eric Dumazet @ 2011-05-10  3:53 UTC (permalink / raw)
  To: Joe Perches; +Cc: David Miller, netdev

Le lundi 09 mai 2011 à 20:42 -0700, Joe Perches a écrit :
> Save a bit of space.
> 
> Signed-off-by: Joe Perches <joe@perches.com>
> ---
>  include/linux/netdevice.h |    8 ++++----
>  1 files changed, 4 insertions(+), 4 deletions(-)
> 

Hmm... correct alignements are far more important for this structure.

Did you run benchmarks on 32bit and 64bit platforms ?

BTW we have ____cacheline_aligned_in_smp markers, I am not even sure
this patch saves space.

> diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
> index d5de66a..0fcb86b 100644
> --- a/include/linux/netdevice.h
> +++ b/include/linux/netdevice.h
> @@ -1020,9 +1020,6 @@ struct net_device {
>  	 *	part of the usual set specified in Space.c.
>  	 */
>  
> -	unsigned char		if_port;	/* Selectable AUI, TP,..*/
> -	unsigned char		dma;		/* DMA channel		*/
> -
>  	unsigned long		state;
>  
>  	struct list_head	dev_list;
> @@ -1141,13 +1138,16 @@ struct net_device {
>  	const struct header_ops *header_ops;
>  
>  	unsigned int		flags;	/* interface flags (a la BSD)	*/
> +	unsigned int		priv_flags; /* Like 'flags' but invisible to userspace. */
>  	unsigned short		gflags;
> -        unsigned int            priv_flags; /* Like 'flags' but invisible to userspace. */
>  	unsigned short		padded;	/* How much padding added by alloc_netdev() */
>  
>  	unsigned char		operstate; /* RFC2863 operstate */
>  	unsigned char		link_mode; /* mapping policy to operstate */
>  
> +	unsigned char		if_port;	/* Selectable AUI, TP,..*/
> +	unsigned char		dma;		/* DMA channel		*/
> +
>  	unsigned int		mtu;	/* interface MTU value		*/
>  	unsigned short		type;	/* interface hardware type	*/
>  	unsigned short		hard_header_len;	/* hardware hdr length	*/
> 



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

* Re: [PATCH net-next] netdevice.h: Align struct netdevices members
  2011-05-10  3:53 ` Eric Dumazet
@ 2011-05-10  4:22   ` Joe Perches
  2011-05-12 22:05     ` David Miller
  0 siblings, 1 reply; 7+ messages in thread
From: Joe Perches @ 2011-05-10  4:22 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: David Miller, netdev

On Tue, 2011-05-10 at 05:53 +0200, Eric Dumazet wrote:
> Le lundi 09 mai 2011 à 20:42 -0700, Joe Perches a écrit :
> > Save a bit of space.
> Hmm... correct alignements are far more important for this structure.

I agree.  I aligned these members on "natural" boundaries.
4 consecutive chars rather than 2 chars, unsigned long.
 
> Did you run benchmarks on 32bit and 64bit platforms ?

Nope.

> BTW we have ____cacheline_aligned_in_smp markers, I am not even sure
> this patch saves space.

That depends on whether or not CONFIG_SMP is defined and
all of the changes are before any ____cacheline_aligned markers.



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

* Re: [PATCH net-next] netdevice.h: Align struct netdevices members
  2011-05-10  4:22   ` Joe Perches
@ 2011-05-12 22:05     ` David Miller
  2011-05-12 23:49       ` Joe Perches
  2011-05-13 17:47       ` Eric Dumazet
  0 siblings, 2 replies; 7+ messages in thread
From: David Miller @ 2011-05-12 22:05 UTC (permalink / raw)
  To: joe; +Cc: eric.dumazet, netdev

From: Joe Perches <joe@perches.com>
Date: Mon, 09 May 2011 21:22:05 -0700

> On Tue, 2011-05-10 at 05:53 +0200, Eric Dumazet wrote:
>> Le lundi 09 mai 2011 à 20:42 -0700, Joe Perches a écrit :
>> > Save a bit of space.
>> Hmm... correct alignements are far more important for this structure.
> 
> I agree.  I aligned these members on "natural" boundaries.
> 4 consecutive chars rather than 2 chars, unsigned long.
>  
>> Did you run benchmarks on 32bit and 64bit platforms ?
> 
> Nope.
> 
>> BTW we have ____cacheline_aligned_in_smp markers, I am not even sure
>> this patch saves space.
> 
> That depends on whether or not CONFIG_SMP is defined and
> all of the changes are before any ____cacheline_aligned markers.

I think this is sane, Eric do you still have objections?

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

* Re: [PATCH net-next] netdevice.h: Align struct netdevices members
  2011-05-12 22:05     ` David Miller
@ 2011-05-12 23:49       ` Joe Perches
  2011-05-13 17:47       ` Eric Dumazet
  1 sibling, 0 replies; 7+ messages in thread
From: Joe Perches @ 2011-05-12 23:49 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, Eric Dumazet

On Thu, 2011-05-12 at 15:05 -0700, David Miller wrote:
> I think this is sane, Eric do you still have objections?

Hey David.

If you apply this, can you please correct the
subject line typo from netdevices to net_device?

Thanks, Joe


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

* Re: [PATCH net-next] netdevice.h: Align struct netdevices members
  2011-05-12 22:05     ` David Miller
  2011-05-12 23:49       ` Joe Perches
@ 2011-05-13 17:47       ` Eric Dumazet
  1 sibling, 0 replies; 7+ messages in thread
From: Eric Dumazet @ 2011-05-13 17:47 UTC (permalink / raw)
  To: David Miller; +Cc: joe, netdev

Le jeudi 12 mai 2011 à 15:05 -0700, David Miller a écrit :

> I think this is sane, Eric do you still have objections?

No objection, thanks



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

* Re: [PATCH net-next] netdevice.h: Align struct netdevices members
  2011-05-10  3:42 [PATCH net-next] netdevice.h: Align struct netdevices members Joe Perches
  2011-05-10  3:53 ` Eric Dumazet
@ 2011-05-13 18:07 ` David Miller
  1 sibling, 0 replies; 7+ messages in thread
From: David Miller @ 2011-05-13 18:07 UTC (permalink / raw)
  To: joe; +Cc: netdev

From: Joe Perches <joe@perches.com>
Date: Mon, 09 May 2011 20:42:46 -0700

> Save a bit of space.
> 
> Signed-off-by: Joe Perches <joe@perches.com>

Applied with "sed 's/netdevices/net_device/" in Subject as
requested.

Thanks.

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

end of thread, other threads:[~2011-05-13 18:08 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-10  3:42 [PATCH net-next] netdevice.h: Align struct netdevices members Joe Perches
2011-05-10  3:53 ` Eric Dumazet
2011-05-10  4:22   ` Joe Perches
2011-05-12 22:05     ` David Miller
2011-05-12 23:49       ` Joe Perches
2011-05-13 17:47       ` Eric Dumazet
2011-05-13 18:07 ` David Miller

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).