[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150320222106.GA24241@gondor.apana.org.au>
Date: Sat, 21 Mar 2015 09:21:06 +1100
From: Herbert Xu <herbert@...dor.apana.org.au>
To: David Miller <davem@...emloft.net>
Cc: tgraf@...g.ch, eric.dumazet@...il.com, kaber@...sh.net,
netdev@...r.kernel.org
Subject: Re: [v1 PATCH 0/7] rhashtable: Introduce inlined interface
On Fri, Mar 20, 2015 at 06:17:15PM -0400, David Miller wrote:
> From: Herbert Xu <herbert@...dor.apana.org.au>
> Date: Sat, 21 Mar 2015 08:28:44 +1100
>
> > On Fri, Mar 20, 2015 at 04:17:43PM -0400, David Miller wrote:
> >>
> >> Why do you need that trailer[] think in the new netlink code?
> >> You only use it in an offsetof() expression and wouldn't sizeof
> >> the structure work just fine for that? This also makes the
> >> memset() superfluous in the initializer function.
> >
> > Aha I was wating for someone to ask :) Without the trailer it
> > gets padded to 16 bytes on x86-64. I found this out because
> > netlink was mysteriously failing due to the extra padding not
> > getting zeroed. Designated initializers do not zero padding bytes,
> > so you'd need an explicit memset. Besides, hashing another
> > four bytes with jhash that always contained zero seemed wasteful.
>
> Then "offsetof(struct netlink_compare_arg, portid) + sizeof(u32)"?
But that should be identical to the trailer offset, no? The whole
structure gets padded to 16 bytes, not the trailer (since it's only
a char[]).
Cheers,
--
Email: Herbert Xu <herbert@...dor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists