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

[xen staging] device-tree: optimize size of struct dt_device_node



commit 0207fee58d1db2a5dd0b1ab689c6504a9dfa7431
Author:     Michal Orzel <michal.orzel@xxxxxxx>
AuthorDate: Wed Feb 12 17:43:58 2025 +0200
Commit:     Stefano Stabellini <stefano.stabellini@xxxxxxx>
CommitDate: Mon Mar 3 16:07:27 2025 -0800

    device-tree: optimize size of struct dt_device_node
    
    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>
    Reviewed-by: Stefano Stabellini <sstabellini@xxxxxxxxxx>
---
 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 5ff763bb80..0ff80fda04 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.
--
generated by git-patchbot for /home/xen/git/xen.git#staging



 


Rackspace

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