Re: [RFC PATCH 10/16 v3] Workload Consolidation APIs
From: Peter Zijlstra
Date: Tue Jun 03 2014 - 08:22:55 EST
On Fri, May 30, 2014 at 02:36:06PM +0800, Yuyang Du wrote:
> Currently, CPU CC is per CPU. To consolidate, the formula is based on a heuristic.
> Suppose we have 2 CPUs, their task concurrency over time is ('-' means no
> task, 'x' having tasks):
>
> 1)
> CPU0: ---xxxx---------- (CC[0])
> CPU1: ---------xxxx---- (CC[1])
>
> 2)
> CPU0: ---xxxx---------- (CC[0])
> CPU1: ---xxxx---------- (CC[1])
>
> If we consolidate CPU0 and CPU1, the consolidated CC will be: CC' = CC[0] +
> CC[1] for case 1 and CC'' = (CC[0] + CC[1]) * 2 for case 2. For the cases in
> between case 1 and 2 in terms of how xxx overlaps, the CC should be between
> CC' and CC''. So, we uniformly use this condition for consolidation (suppose
> we consolidate m CPUs to n CPUs, m > n):
>
> (CC[0] + CC[1] + ... + CC[m-2] + CC[m-1]) * (n + log(m-n)) >=<? (1 * n) * n *
> consolidating_coefficient
>
> The consolidating_coefficient could be like 100% or more or less.
>
I'm still struggling to match that to the code presented.
> +/*
> + * as of now, we have the following assumption
> + * 1) every sched_group has the same weight
> + * 2) every CPU has the same computing power
> + */
Those are complete non starters.
> +/*
> + * wc_nonshielded_mask - return the nonshielded cpus in the @mask,
> + * which is unmasked by the shielded cpus
> + *
> + * traverse downward the sched_domain tree when the sched_domain contains
> + * flag SD_WORKLOAD_CONSOLIDATION, each sd may have more than two groups
WTF is a shielded/nonshielded cpu?
> +static int cpu_task_hot(struct task_struct *p, u64 now)
> +{
> + s64 delta;
> +
> + if (p->sched_class != &fair_sched_class)
> + return 0;
> +
> + if (unlikely(p->policy == SCHED_IDLE))
> + return 0;
> +
> + if (wc_push_hot_task)
> + return 0;
> +
> + /*
> + * Buddy candidates are cache hot:
> + */
> + if (sched_feat(CACHE_HOT_BUDDY) && this_rq()->nr_running &&
> + (&p->se == cfs_rq_of(&p->se)->next ||
> + &p->se == cfs_rq_of(&p->se)->last))
> + return 1;
> +
> + if (sysctl_sched_migration_cost == -1)
> + return 1;
> + if (sysctl_sched_migration_cost == 0)
> + return 0;
> +
> + delta = now - p->se.exec_start;
> +
> + return delta < (s64)sysctl_sched_migration_cost;
> +}
In what universe to we need an exact copy of task_hot() ?
and on and on it goes.. :-(
Attachment:
pgpv0HC5SlXYn.pgp
Description: PGP signature