On Fri, Nov 18, 2022 at 01:23:36AM +0100, Andrew Lunn wrote: > > struct vchiq_mmal_component { > > - u32 in_use:1; > > + bool in_use:1; > > bool enabled:1; > > The patch you referenced says: > > +If a structure has many true/false values, consider consolidating them into a > +bitfield with 1 bit members, or using an appropriate fixed width type, such as > +u8. > > The code did exactly this, using two bits fields, in one u32. A bool > probably takes up 4 bytes, maybe 8 bytes, so this change probably > doubles the storage size for these two fields. In GCC and Clang bools take a byte, but the C language is vague and other compilers are free to do it differently. > Are these fields on the > hot path, where an extra AND instruction would make a difference? This patch takes the first u32 for "in_use" and squeezes it into the same byte as "enabled" so it makes the struct four bytes smaller. There is still a 3 byte struct hole between "enabled" and "handle" so we could add more 62 bool bitfields if we wanted. In the v2 patch these become: bool in_use; bool enabled; One byte each and there is a two byte gap before "handle". regards, dan carpenter