Subject: Re: [Patch net-next] tcp_metrics: rearrange fields to avoid holes

From: Cong Wang <[email-masked]>
Date: Thu, 01 Aug 2013 10:48:31 +0800

On Tue, 2013-07-30 at 23:26 -0700, David Miller wrote:
> From: Cong Wang <[email-masked]>
> Date: Wed, 31 Jul 2013 11:13:22 +0800
> 
> > I know saving 8 bytes is not interesting for you, but it is for me,
> > since I need some room in struct tcp_metrics_block for union inet_addr.
> > With this patch, I don't have to make struct tcp_metrics_block expand to
> > 3 cachelines. :)
> 
> Cong, please.
> 
> Instead of making code accomodate an unnecessarily large "union
> inet_addr", make a small version of it that accomodates this use case
> and doesn't have the extra fields.

Please teach me how to do that?

The fields not used by inetpeer are sin_port and scope_id etc., and
sin_port is in the middle of sockaddr* structs.

Hmm, maybe just define a new struct by kicking the last field from
struct sockaddr_{in,in6}, so that we can at least shrink 4 bytes.

Except this, I have no idea how to do that.

Thanks!