]> xenbits.xensource.com Git - xen.git/commitdiff
xen: credit: rearrange members of control structures
authorDario Faggioli <dario.faggioli@citrix.com>
Fri, 23 Jun 2017 10:55:05 +0000 (12:55 +0200)
committerGeorge Dunlap <george.dunlap@citrix.com>
Fri, 21 Jul 2017 17:22:03 +0000 (18:22 +0100)
With the aim of improving memory size and layout, and
at the same time trying to put related fields reside
in the same cacheline.

Here's a summary of the output of `pahole`, with and
without this patch, for the affected data structures.

csched_pcpu:
 * Before:
    size: 88, cachelines: 2, members: 6
    sum members: 80, holes: 1, sum holes: 4
    padding: 4
    paddings: 1, sum paddings: 5
    last cacheline: 24 bytes
 * After:
    size: 80, cachelines: 2, members: 6
    paddings: 1, sum paddings: 5
    last cacheline: 16 bytes

csched_vcpu:
 * Before:
    size: 72, cachelines: 2, members: 9
    padding: 2
    last cacheline: 8 bytes
 * After:
    same numbers, but move some fields to put
    related fields in same cache line.

csched_private:
 * Before:
    size: 152, cachelines: 3, members: 17
    sum members: 140, holes: 2, sum holes: 8
    padding: 4
    paddings: 1, sum paddings: 5
    last cacheline: 24 bytes
 * After:
    same numbers, but move some fields to put
    related fields in same cache line.

Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
Acked-by: George Dunlap <george.dunlap@citrix.com>
xen/common/sched_credit.c

index efdf6bf2f362bebae5889a169de252c788eb73f9..4f6330e25f0495082c12656dc5104c0c883aa028 100644 (file)
@@ -169,10 +169,12 @@ integer_param("sched_credit_tslice_ms", sched_credit_tslice_ms);
 struct csched_pcpu {
     struct list_head runq;
     uint32_t runq_sort_last;
-    struct timer ticker;
-    unsigned int tick;
+
     unsigned int idle_bias;
     unsigned int nr_runnable;
+
+    unsigned int tick;
+    struct timer ticker;
 };
 
 /*
@@ -181,13 +183,18 @@ struct csched_pcpu {
 struct csched_vcpu {
     struct list_head runq_elem;
     struct list_head active_vcpu_elem;
+
+    /* Up-pointers */
     struct csched_dom *sdom;
     struct vcpu *vcpu;
-    atomic_t credit;
-    unsigned int residual;
+
     s_time_t start_time;   /* When we were scheduled (used for credit) */
     unsigned flags;
-    int16_t pri;
+    int pri;
+
+    atomic_t credit;
+    unsigned int residual;
+
 #ifdef CSCHED_STATS
     struct {
         int credit_last;
@@ -219,21 +226,25 @@ struct csched_dom {
 struct csched_private {
     /* lock for the whole pluggable scheduler, nests inside cpupool_lock */
     spinlock_t lock;
-    struct list_head active_sdom;
-    uint32_t ncpus;
-    struct timer  master_ticker;
-    unsigned int master;
+
     cpumask_var_t idlers;
     cpumask_var_t cpus;
+    uint32_t *balance_bias;
+    uint32_t runq_sort;
+    unsigned int ratelimit_us;
+
+    /* Period of master and tick in milliseconds */
+    unsigned int tslice_ms, tick_period_us, ticks_per_tslice;
+    uint32_t ncpus;
+
+    struct list_head active_sdom;
     uint32_t weight;
     uint32_t credit;
     int credit_balance;
-    uint32_t runq_sort;
-    uint32_t *balance_bias;
-    unsigned ratelimit_us;
-    /* Period of master and tick in milliseconds */
-    unsigned tslice_ms, tick_period_us, ticks_per_tslice;
-    unsigned credits_per_tslice;
+    unsigned int credits_per_tslice;
+
+    unsigned int master;
+    struct timer master_ticker;
 };
 
 static void csched_tick(void *_cpu);