[ovs-dev] [PATCH] openvswitch: fix sw_flow_key alignment

Jesse Gross jesse at nicira.com
Tue Sep 3 22:06:36 UTC 2013


On Fri, Aug 30, 2013 at 9:16 PM, David Miller <davem at davemloft.net> wrote:
> From: Jesse Gross <jesse at nicira.com>
> Date: Fri, 30 Aug 2013 16:20:25 -0700
>
>> I looked through the struct definition and I think that the idea of
>> manually padding as Geert did in his patch will be difficult to
>> maintain over time (and actually there are a few that he missed) since
>> there are a number of different structs/unions contained in there.
>
> You have to be mindful of the gaps and wasted space for performance
> reasons anyways.

Yes, although the approaches for performance and correctness are not
necessarily the same. For example, we're taking about potentially
packing the struct, in which case we would still have the same
alignment needs even without any gaps. If the correctness is clearly
handled (through an explicit align and build assert) then it's easier
to pack/rearrange/whatever for performance since the whole thing isn't
fragile.



More information about the dev mailing list