> Nitpick: by putting some integers after a u8, you are creating a hole > for 3 bytes between gs_usb->active_channels and gs_usb->pipe_in, as > shown by the pahole tool: > > $ pahole --class_name=gs_usb drivers/net/can/usb/gs_usb.o > struct gs_usb { > struct gs_can * canch[3]; /* 0 24 */ > struct usb_anchor rx_submitted; /* 24 56 */ > > /* XXX last struct has 4 bytes of padding, 31 bits of padding */ > > /* --- cacheline 1 boundary (64 bytes) was 16 bytes ago --- */ > struct usb_device * udev; /* 80 8 */ > struct cyclecounter cc; /* 88 24 */ > struct timecounter tc; /* 112 40 */ > /* --- cacheline 2 boundary (128 bytes) was 24 bytes ago --- */ > spinlock_t tc_lock; /* 152 4 */ > > /* XXX 4 bytes hole, try to pack */ > > struct delayed_work timestamp; /* 160 88 */ > > /* XXX last struct has 4 bytes of padding */ > > /* --- cacheline 3 boundary (192 bytes) was 56 bytes ago --- */ > unsigned int hf_size_rx; /* 248 4 */ > u8 active_channels; /* 252 1 */ > > /* XXX 3 bytes hole, try to pack */ > > /* --- cacheline 4 boundary (256 bytes) --- */ > unsigned int pipe_in; /* 256 4 */ > unsigned int pipe_out; /* 260 4 */ > > /* size: 264, cachelines: 5, members: 11 */ > /* sum members: 257, holes: 2, sum holes: 7 */ > /* member types with bit paddings: 1, total: 31 bits */ > /* paddings: 2, sum paddings: 8 */ > /* last cacheline: 8 bytes */ > }; > > This 3 bytes hole will always exist even if you group the integers > together (because the padding also occurs at the end of the structure) > *but*, it is easier to maintain if the hole is at the end. > > So, in summary, do it like this: > > unsigned int hf_size_rx; > + unsigned int pipe_in; > + unsigned int pipe_out; > u8 active_channels; > }; > > Note that there is also 2 other 4 bytes holes, so a packing > optimization could be done here, but this is out of scope of your > patch. If you want to address that, it must go in a different patch > because, this time, it is another "logical change". Thank you Vincent for this optional nitpick. For sake of simplicity I would prefer to skip this change, but I've got your point about additional "logical change".