aboutsummaryrefslogtreecommitdiffstats
path: root/usb-usb.h-tweak-struct-urb-to-remove-wasted-space.patch
blob: 83641335d1f9b1bdf6d9f6606f1c67568303a094 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
From cde8161f9ee466655588b66a106276044b2fc282 Mon Sep 17 00:00:00 2001
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date: Fri, 1 Mar 2019 18:13:27 +0100
Subject: [PATCH] USB: usb.h: tweak struct urb to remove wasted space

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 |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -1545,10 +1545,10 @@ typedef void (*usb_complete_t)(struct ur
 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