public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches•com>
To: Marcelo Ricardo Leitner <marcelo.leitner@gmail•com>,
	netdev@vger•kernel.org
Cc: Neil Horman <nhorman@tuxdriver•com>,
	Vlad Yasevich <vyasevich@gmail•com>,
	linux-sctp@vger•kernel.org
Subject: Re: [PATCH v2 1/2] sctp: compress bit-wide flags to a bitfield on sctp_sock
Date: Wed, 06 Apr 2016 12:53:24 -0700	[thread overview]
Message-ID: <1459972404.6715.65.camel@perches.com> (raw)
In-Reply-To: <69a5ce012d9978ce73aade0004c5937964c54d61.1459952558.git.marcelo.leitner@gmail.com>

On Wed, 2016-04-06 at 14:53 -0300, Marcelo Ricardo Leitner wrote:
> It wastes space and gets worse as we add new flags, so convert bit-wide
> flags to a bitfield.
> 
> Currently it already saves 4 bytes in sctp_sock, which are left as holes
> in it for now. The whole struct needs packing, which should be done in
> another patch.
> 
> Note that do_auto_asconf cannot be merged, as explained in the comment
> before it.
> 
> Signed-off-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail•com>
> ---
[]
> diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
[]
> @@ -210,14 +210,14 @@ struct sctp_sock {
>  	int user_frag;
>  
>  	__u32 autoclose;
> -	__u8 nodelay;
> -	__u8 disable_fragments;
> -	__u8 v4mapped;
> -	__u8 frag_interleave;
>  	__u32 adaptation_ind;
>  	__u32 pd_point;
> -	__u8 recvrcvinfo;
> -	__u8 recvnxtinfo;
> +	__u16	nodelay:1,
> +		disable_fragments:1,
> +		v4mapped:1,
> +		frag_interleave:1,
> +		recvrcvinfo:1,
> +		recvnxtinfo:1;

Might as well make this __u32 as the next field would be
aligned on an atomic_t

It might be better if these fields didn't use the __ prefix.

  reply	other threads:[~2016-04-06 19:53 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-06 17:53 [PATCH v2 0/2] sctp: delay calls to sk_data_ready() as much as possible Marcelo Ricardo Leitner
2016-04-06 17:53 ` [PATCH v2 1/2] sctp: compress bit-wide flags to a bitfield on sctp_sock Marcelo Ricardo Leitner
2016-04-06 19:53   ` Joe Perches [this message]
2016-04-06 19:57     ` David Miller
2016-04-06 21:21       ` marcelo.leitner
2016-04-06 17:53 ` [PATCH v2 2/2] sctp: delay calls to sk_data_ready() as much as possible Marcelo Ricardo Leitner
2016-04-07  8:05   ` Jakub Sitnicki
2016-04-07 13:35     ` Marcelo Ricardo Leitner

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=1459972404.6715.65.camel@perches.com \
    --to=joe@perches$(echo .)com \
    --cc=linux-sctp@vger$(echo .)kernel.org \
    --cc=marcelo.leitner@gmail$(echo .)com \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=nhorman@tuxdriver$(echo .)com \
    --cc=vyasevich@gmail$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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