[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] device-tree: optimize size of struct dt_device_node



From: Michal Orzel <michal.orzel@xxxxxxx>

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 */

Signed-off-by: Michal Orzel <michal.orzel@xxxxxxx>
Signed-off-by: Grygorii Strashko <grygorii_strashko@xxxxxxxx>
---
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(-)

diff --git a/xen/include/xen/device_tree.h b/xen/include/xen/device_tree.h
index 5ff763bb80bb..0ff80fda04da 100644
--- a/xen/include/xen/device_tree.h
+++ b/xen/include/xen/device_tree.h
@@ -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.
-- 
2.34.1




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.