device-tree: optimize size of struct dt_device_node
PATCH 1/1 device-tree: optimize size of struct dt_device_node
From: Michal Orzel <[email protected]>
The current placement of fields in struct dt_device_node is not optimal and introduces holes due to fields alignment.
Checked with "'pahole xen-syms -C dt_device_node"
ARM64 size 144B, 16B holes:
/* size: 144, cachelines: 3, members: 15 */ /* sum members: 128, holes: 3, sum holes: 16 */ /* last cacheline: 16 bytes */ ARM32 size 72B, 4B holes /* size: 72, cachelines: 2, members: 15 */ /* sum members: 68, holes: 2, sum holes: 4 */ /* last cacheline: 8 bytes */
This patch optimizes size of struct dt_device_node by rearranging its field, which eliminates holes and reduces structure size by 16B(ARM64) and 4B(ARM32).
After ARM64 size 128B, no holes (-16B):
/* size: 128, cachelines: 2, members: 15 */ After ARM32 size 68B, no holes (-4B) /* size: 68, cachelines: 2, members: 15 */ /* last cacheline: 4 bytes */
---
This patch follows discussion in [1]
[1] https://patchwork.kernel.org/comment/26239672/
xen/include/xen/device_tree.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
xen/include/xen/device_tree.h +8 -8
@@ -81,17 +81,10 @@ struct dt_property {struct dt_device_node {const char *name;const char *type; -dt_phandle phandle;char *full_name; +dt_phandle phandle;domid_t used_by;/* By default it's used by dom0 */ -struct dt_property *properties; -struct dt_device_node *parent; -struct dt_device_node *child; -struct dt_device_node *sibling; -struct dt_device_node *next;/* TODO: Remove it. Only use to know the last children */ -struct dt_device_node *allnext; -/* IOMMU specific fields */ bool is_protected;
@@ -100,6 +93,13 @@ struct dt_device_node {bool static_evtchn_created;#endif +struct dt_property *properties; +struct dt_device_node *parent; +struct dt_device_node *child; +struct dt_device_node *sibling; +struct dt_device_node *next;/* TODO: Remove it. Only use to know the last children */ +struct dt_device_node *allnext; +/* * The main purpose of this list is to link the structure in the list * of devices assigned to domain.
Signature · 1 line
2.34.1
Quoted 20 lines · Grygorii Strashko
From: Michal Orzel <[email protected]>
The current placement of fields in struct
dt_device_nodeis not optimal and introduces holes due to fields alignment.Checked with "'pahole xen-syms -C
dt_device_node"ARM64 size 144B, 16B holes:
/* size: 144, cachelines: 3, members: 15 */ /* sum members: 128, holes: 3, sum holes: 16 */ /* last cacheline: 16 bytes */ ARM32 size 72B, 4B holes /* size: 72, cachelines: 2, members: 15 */ /* sum members: 68, holes: 2, sum holes: 4 */ /* last cacheline: 8 bytes */This patch optimizes size of struct
dt_device_nodeby rearranging its field, which eliminates holes and reduces structure size by 16B(ARM64) and 4B(ARM32).
Quoted 8 lines
After ARM64 size 128B, no holes (-16B):
/* size: 128, cachelines: 2, members: 15 */ After ARM32 size 68B, no holes (-4B) /* size: 68, cachelines: 2, members: 15 */ /* last cacheline: 4 bytes */Signed-off-by Michal Orzel <[email protected]>Signed-off-by Grygorii Strashko <[email protected]>
Quoted 47 lines
---
This patch follows discussion in [1]
[1] https://patchwork.kernel.org/comment/26239672/xen/include/xen/device_tree.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)xen/include/xen/device_tree.h +8
-8@@ -81,17 +81,10 @@ struct dt_property {struct dt_device_node {const char *name;const char *type; -dt_phandle phandle;char *full_name; +dt_phandle phandle;domid_t used_by;/* By default it's used by dom0 */ -struct dt_property *properties; -struct dt_device_node *parent; -struct dt_device_node *child; -struct dt_device_node *sibling; -struct dt_device_node *next;/* TODO: Remove it. Only use to know the last children */ -struct dt_device_node *allnext; -/* IOMMU specific fields */ bool is_protected;@@ -100,6 +93,13 @@ struct dt_device_node {bool static_evtchn_created;#endif +struct dt_property *properties; +struct dt_device_node *parent; +struct dt_device_node *child; +struct dt_device_node *sibling; +struct dt_device_node *next;/* TODO: Remove it. Only use to know the last children */ +struct dt_device_node *allnext; +/* * The main purpose of this list is to link the structure in the list * of devices assigned to domain. Signature · 1 line
2.34.1