From: Dario Faggioli Date: Fri, 23 Jun 2017 10:55:05 +0000 (+0200) Subject: xen: credit: rearrange members of control structures X-Git-Tag: 4.10.0-rc1~707 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=e371d3587bb2b2fa08de3a3560b3fe7a8c1e02ec;p=xen.git xen: credit: rearrange members of control structures 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 Acked-by: George Dunlap --- diff --git a/xen/common/sched_credit.c b/xen/common/sched_credit.c index efdf6bf2f3..4f6330e25f 100644 --- a/xen/common/sched_credit.c +++ b/xen/common/sched_credit.c @@ -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);