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

Re: [Xen-devel] [PATCH 3/6] xen: credit: rearrange members of control structures



On 06/23/2017 11:55 AM, Dario Faggioli wrote:
> 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@xxxxxxxxxx>

Acked-by: George Dunlap <george.dunlap@xxxxxxxxxx>

> ---
> Cc: George Dunlap <george.dunlap@xxxxxxxxxx>
> Cc: Anshul Makkar <anshulmakkar@xxxxxxxxx>
> ---
>  xen/common/sched_credit.c |   41 ++++++++++++++++++++++++++---------------
>  1 file changed, 26 insertions(+), 15 deletions(-)
> 
> diff --git a/xen/common/sched_credit.c b/xen/common/sched_credit.c
> index efdf6bf..4f6330e 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);
> 


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

 


Rackspace

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