Re: wake_wide mechanism clarification
From: Mike Galbraith
Date: Fri Jun 30 2017 - 13:02:37 EST
On Fri, 2017-06-30 at 10:28 -0400, Josef Bacik wrote:
> On Thu, Jun 29, 2017 at 08:04:59PM -0700, Joel Fernandes wrote:
>
> > That makes sense that we multiply slave's flips by a factor because
> > its low, but I still didn't get why the factor is chosen to be
> > llc_size instead of something else for the multiplication with slave
> > (slave * factor).
> Yeah I don't know why llc_size was chosen...
static void update_top_cache_domain(int cpu)
{
ÂÂÂÂÂÂÂÂstruct sched_domain_shared *sds = NULL;
ÂÂÂÂÂÂÂÂstruct sched_domain *sd;
ÂÂÂÂÂÂÂÂint id = cpu;
ÂÂÂÂÂÂÂÂint size = 1;
ÂÂÂÂÂÂÂÂsd = highest_flag_domain(cpu, SD_SHARE_PKG_RESOURCES);
ÂÂÂÂÂÂÂÂif (sd) {
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂid = cpumask_first(sched_domain_span(sd));
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂsize = cpumask_weight(sched_domain_span(sd));
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂsds = sd->shared;
ÂÂÂÂÂÂÂÂ}
ÂÂÂÂÂÂÂÂrcu_assign_pointer(per_cpu(sd_llc, cpu), sd);
ÂÂÂÂÂÂÂÂper_cpu(sd_llc_size, cpu) = size;
The goal of wake wide was to approximate when pulling would be a futile
consolidation effort and counterproductive to scaling. Â'course with
ever increasing socket size, any 1:N waker is ever more likely to run
out of CPU for its one and only self (slamming into scaling wall)
before it needing to turn its minions loose to conquer the world.
Something else to consider: network interrupt waking multiple workers
at high frequency. ÂIf the waking CPU is idle, do you really want to
place a worker directly in front of a tattoo artist, or is it better
off nearly anywhere but there?
If the box is virtual, with no topology exposed (or real but ancient)
to let select_idle_sibling() come to the rescue, two workers can even
get tattooed simultaneously (see sync wakeup).Â
-Mike