All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vlad Yasevich <vyasevich@gmail.com>
To: Daniel Borkmann <dborkman@redhat.com>
Cc: David Laight <David.Laight@ACULAB.COM>,
	davem@davemloft.net, netdev@vger.kernel.org,
	linux-sctp@vger.kernel.org
Subject: Re: [PATCH net-next 4/9] net: sctp: sctp_outq: consolidate chars into bitfield
Date: Wed, 17 Apr 2013 15:44:11 +0000	[thread overview]
Message-ID: <516EC34B.1040503@gmail.com> (raw)
In-Reply-To: <516E6ABD.2040904@redhat.com>

On 04/17/2013 05:26 AM, Daniel Borkmann wrote:
> On 04/17/2013 10:43 AM, David Laight wrote:
>>>       __u32 outstanding_bytes;
>>>
>>> -    /* Are we doing fast-rtx on this queue */
>>> -    char fast_rtx;
>>> -
>>> -    /* Corked? */
>>> -    char cork;
>>> -
>>> -    /* Is this structure empty?  */
>>> -    char empty;
>>> +    __u8 fast_rtx:1,    /* Are we doing fast-rtx on this queue */
>>> +         cork:1,        /* Corked? */
>>> +         empty:1;        /* Is this structure empty?  */
>>>   };
>>
>> Use of bitfields just makes the code slower.
>> The only real excuse for using them is to reduce the size
>> of a structure that is allocated a lot.
>
> sctp_outq is _embedded_ into an sctp_association structure, which
> has [size: 2280, cachelines: 36, members: 76]! A next step would be
> to try to reorder its elements carefully and see if we can reduce
> the size by filling some holes.

I remember attempting this undertaking that led me down the rabbit hole 
so fast that my head started to spin.  It is a badly needed project, but 
be prepared to spend a lot of time on it.

Not sure if the space saving is worth the bad code generated for 
bit-fields, especially considering that empty and cork are used on 
almost every packet.

-vlad

> --
> To unsubscribe from this list: send the line "unsubscribe linux-sctp" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


WARNING: multiple messages have this Message-ID (diff)
From: Vlad Yasevich <vyasevich@gmail.com>
To: Daniel Borkmann <dborkman@redhat.com>
Cc: David Laight <David.Laight@ACULAB.COM>,
	davem@davemloft.net, netdev@vger.kernel.org,
	linux-sctp@vger.kernel.org
Subject: Re: [PATCH net-next 4/9] net: sctp: sctp_outq: consolidate chars into bitfield
Date: Wed, 17 Apr 2013 11:44:11 -0400	[thread overview]
Message-ID: <516EC34B.1040503@gmail.com> (raw)
In-Reply-To: <516E6ABD.2040904@redhat.com>

On 04/17/2013 05:26 AM, Daniel Borkmann wrote:
> On 04/17/2013 10:43 AM, David Laight wrote:
>>>       __u32 outstanding_bytes;
>>>
>>> -    /* Are we doing fast-rtx on this queue */
>>> -    char fast_rtx;
>>> -
>>> -    /* Corked? */
>>> -    char cork;
>>> -
>>> -    /* Is this structure empty?  */
>>> -    char empty;
>>> +    __u8 fast_rtx:1,    /* Are we doing fast-rtx on this queue */
>>> +         cork:1,        /* Corked? */
>>> +         empty:1;        /* Is this structure empty?  */
>>>   };
>>
>> Use of bitfields just makes the code slower.
>> The only real excuse for using them is to reduce the size
>> of a structure that is allocated a lot.
>
> sctp_outq is _embedded_ into an sctp_association structure, which
> has [size: 2280, cachelines: 36, members: 76]! A next step would be
> to try to reorder its elements carefully and see if we can reduce
> the size by filling some holes.

I remember attempting this undertaking that led me down the rabbit hole 
so fast that my head started to spin.  It is a badly needed project, but 
be prepared to spend a lot of time on it.

Not sure if the space saving is worth the bad code generated for 
bit-fields, especially considering that empty and cork are used on 
almost every packet.

-vlad

> --
> To unsubscribe from this list: send the line "unsubscribe linux-sctp" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2013-04-17 15:44 UTC|newest]

Thread overview: 68+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-16 21:07 [PATCH net-next 0/9] Minor SCTP cleanups all over the place Daniel Borkmann
2013-04-16 21:07 ` Daniel Borkmann
2013-04-16 21:07 ` [PATCH net-next 1/9] net: sctp: sctp_ssnmap: remove 'malloced' element from struct Daniel Borkmann
2013-04-16 21:07   ` Daniel Borkmann
2013-04-17 12:45   ` Neil Horman
2013-04-17 12:45     ` Neil Horman
2013-04-17 12:52     ` Daniel Borkmann
2013-04-17 12:52       ` Daniel Borkmann
2013-04-17 17:17       ` Daniel Borkmann
2013-04-17 17:17         ` Daniel Borkmann
2013-04-17 19:18         ` Neil Horman
2013-04-17 19:18           ` Neil Horman
2013-04-16 21:07 ` [PATCH net-next 2/9] net: sctp: sctp_inq: remove dead code Daniel Borkmann
2013-04-16 21:07   ` Daniel Borkmann
2013-04-17 12:47   ` Neil Horman
2013-04-17 12:47     ` Neil Horman
2013-04-16 21:07 ` [PATCH net-next 3/9] net: sctp: sctp_outq: remove 'malloced' from its struct Daniel Borkmann
2013-04-16 21:07   ` Daniel Borkmann
2013-04-17 12:57   ` Neil Horman
2013-04-17 12:57     ` Neil Horman
2013-04-16 21:07 ` [PATCH net-next 4/9] net: sctp: sctp_outq: consolidate chars into bitfield Daniel Borkmann
2013-04-16 21:07   ` Daniel Borkmann
2013-04-17  8:43   ` David Laight
2013-04-17  8:43     ` David Laight
2013-04-17  9:26     ` Daniel Borkmann
2013-04-17  9:26       ` Daniel Borkmann
2013-04-17 15:27       ` Neil Horman
2013-04-17 15:27         ` Neil Horman
2013-04-17 15:35         ` Vlad Yasevich
2013-04-17 15:35           ` Vlad Yasevich
2013-04-17 15:40           ` Neil Horman
2013-04-17 15:40             ` Neil Horman
2013-04-17 15:38         ` Daniel Borkmann
2013-04-17 15:38           ` Daniel Borkmann
2013-04-17 15:44       ` Vlad Yasevich [this message]
2013-04-17 15:44         ` Vlad Yasevich
2013-04-17 15:31   ` Neil Horman
2013-04-17 15:31     ` Neil Horman
2013-04-16 21:07 ` [PATCH net-next 5/9] net: sctp: outqueue: simplify sctp_outq_uncork function Daniel Borkmann
2013-04-16 21:07   ` Daniel Borkmann
2013-04-17 15:32   ` Neil Horman
2013-04-17 15:32     ` Neil Horman
2013-04-16 21:07 ` [PATCH net-next 6/9] net: sctp: sctp_transport: remove unused variable Daniel Borkmann
2013-04-16 21:07   ` Daniel Borkmann
2013-04-17 15:34   ` Neil Horman
2013-04-17 15:34     ` Neil Horman
2013-04-16 21:07 ` [PATCH net-next 7/9] net: sctp: sctp_bind_addr: remove dead code Daniel Borkmann
2013-04-16 21:07   ` Daniel Borkmann
2013-04-17 15:35   ` Neil Horman
2013-04-17 15:35     ` Neil Horman
2013-04-16 21:07 ` [PATCH net-next 8/9] net: sctp: sctp_ulpq: remove 'malloced' struct member Daniel Borkmann
2013-04-16 21:07   ` Daniel Borkmann
2013-04-17 15:46   ` Neil Horman
2013-04-17 15:46     ` Neil Horman
2013-04-16 21:07 ` [PATCH net-next 9/9] net: sctp: sctp_ulpq: do not use char as a " Daniel Borkmann
2013-04-16 21:07   ` Daniel Borkmann
2013-04-17 15:36   ` Vlad Yasevich
2013-04-17 15:36     ` Vlad Yasevich
2013-04-17 15:41     ` Daniel Borkmann
2013-04-17 15:41       ` Daniel Borkmann
2013-04-17 15:45   ` Neil Horman
2013-04-17 15:45     ` Neil Horman
2013-04-17 16:28     ` David Laight
2013-04-17 16:28       ` David Laight
2013-04-17 18:13 ` [PATCH net-next 0/9] Minor SCTP cleanups all over the place David Miller
2013-04-17 18:13   ` David Miller
2013-04-17 18:55   ` Daniel Borkmann
2013-04-17 18:55     ` Daniel Borkmann

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=516EC34B.1040503@gmail.com \
    --to=vyasevich@gmail.com \
    --cc=David.Laight@ACULAB.COM \
    --cc=davem@davemloft.net \
    --cc=dborkman@redhat.com \
    --cc=linux-sctp@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.