Re: struct fanotify_event_metadata

Andreas Schwab
2010-08-20T13:27:52Z

Eric Paris <eparis@redhat.com> writes:

> Can you help me understand the packed attribute and why it hurts in this
> case?

It changes the alignment of all applicable objects to 1 which means that
the compiler cannot assume _any_ aligment. Thus on STRICT_ALIGNMENT
targets it has to use more expensive access methods to avoid generating
unaligned loads and stores (unless it can infer proper alignment from
the context).

You can add an aligned attribute to raise the assumed alignment again.
Of course, this can only work correctly if the actual alignment of the
object matches the declared one.

> I'm going to compile a couple of test programs (I only have x86 and
> x86_64) to see if I can find what the assembly is doing different but
> maybe you can point me at the information more easily?

Neither x86 nor x86-64 are STRICT_ALIGNMENT targets.

Andreas.

--
Andreas Schwab, schwab@redhat.com
GPG Key fingerprint = D4E8 DBE3 3813 BB5D FA84 5EC7 45C6 250E 6F00 984E
"And now for something completely different."