[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20150320.183701.615035998227406804.davem@davemloft.net>
Date: Fri, 20 Mar 2015 18:37:01 -0400 (EDT)
From: David Miller <davem@...emloft.net>
To: herbert@...dor.apana.org.au
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
From: Herbert Xu <herbert@...dor.apana.org.au>
Date: Sat, 21 Mar 2015 09:21:06 +1100
> 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?
Yep, but I'm saying this alternative expression allows to remove the
trailer which even made me say "what's this for?"
--
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