USB: usb.h: tweak struct urb to remove wasted space
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 1 Mar 2019 17:22:38 +0000 (18:22 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 19 Mar 2019 14:00:34 +0000 (15:00 +0100)
By moving one field around in 'struct urb' we reduce the size of the
structure by 8 bytes.

Before the patch on x86_64 the overall size of the structure as reported
by pahole was:
/* size: 192, cachelines: 3, members: 30 */
/* sum members: 184, holes: 2, sum holes: 8 */
After the patch we now have:
/* size: 184, cachelines: 3, members: 30 */
/* last cacheline: 56 bytes */

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
include/linux/usb.h

index 5e49e82..4229eb7 100644 (file)
@@ -1545,10 +1545,10 @@ typedef void (*usb_complete_t)(struct urb *);
 struct urb {
        /* private: usb core and host controller only fields in the urb */
        struct kref kref;               /* reference count of the URB */
+       int unlinked;                   /* unlink error code */
        void *hcpriv;                   /* private data for host controller */
        atomic_t use_count;             /* concurrent submissions counter */
        atomic_t reject;                /* submissions will fail */
-       int unlinked;                   /* unlink error code */
 
        /* public: documented fields in the urb that can be used by drivers */
        struct list_head urb_list;      /* list head for use by the urb's