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

[Xen-devel] [PATCH] xen/evtchn: rearrange fields



Event channel arrays are allocated in blocks with EVTCHNS_PER_BUCKET
elements, which must be a power of 2.  When XSM is disabled, struct
evtchn is 32 bytes including padding; however, when XSM is enabled, the
structure becomes larger and EVTCHNS_PER_BUCKET is halved.  Rearranging
some of the fields in struct evtchn allows a 4-byte XSM field to fit
within the 32-byte structure.

This rearrangement turns the xen_consumer field of struct evtchn into a
bitfield.  Since this field is an index into the xen_consumers array,
which is currently limited to 8 elements, it is unlikely that the full 8
bits of the field will ever be required.  This field is also used rarely
enough that the slight overhead from applying a bitmask should not cause
problems.

Signed-off-by: Daniel De Graaf <dgdegra@xxxxxxxxxxxxx>
Cc: David Vrabel <david.vrabel@xxxxxxxxxx>
Cc: Keir Fraser <keir@xxxxxxx>
---
 xen/include/xen/sched.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
index b9ba379..0c0793b 100644
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -78,7 +78,8 @@ struct evtchn
 #define ECS_VIRQ         5 /* Channel is bound to a virtual IRQ line.        */
 #define ECS_IPI          6 /* Channel is bound to a virtual IPI line.        */
     u8  state;             /* ECS_* */
-    u8  xen_consumer;      /* Consumer in Xen, if any? (0 = send to guest) */
+    u8  xen_consumer:7;    /* Consumer in Xen, if any? (0 = send to guest) */
+    u8  pending:1;
     u16 notify_vcpu_id;    /* VCPU for local delivery notification */
     u32 port;
     union {
@@ -97,9 +98,8 @@ struct evtchn
         u16 virq;      /* state == ECS_VIRQ */
     } u;
     u8 priority;
-    u8 pending:1;
-    u16 last_vcpu_id;
     u8 last_priority;
+    u16 last_vcpu_id;
 #ifdef XSM_ENABLE
     union {
 #ifdef XSM_NEED_GENERIC_EVTCHN_SSID
-- 
1.8.5.3


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

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