Messages in this thread | | | From | Josh Don <> | Date | Mon, 11 Oct 2021 17:14:29 -0700 | Subject | Re: [PATCH] sched/core: forced idle accounting |
| |
On Sat, Oct 9, 2021 at 11:11 AM Tao Zhou <tao.zhou@linux.dev> wrote: [snip] > > + smt_count = cpumask_weight(smt_mask); > > + if (smt_count > 2) { > > + unsigned int nr_forced_idle = 0, nr_running = 0; > > + > > + for_each_cpu(i, smt_mask) { > > + rq_i = cpu_rq(i); > > + p = rq_i->core_pick ?: rq_i->curr; > > + > > + if (p != rq_i->idle) > > + nr_running++; > > + else if (rq_i->nr_running) > > + nr_forced_idle++; > > + } > > + > > + if (WARN_ON_ONCE(!nr_running)) { > > + /* can't be forced idle without a running task */ > > + } else { > > + delta *= nr_forced_idle; > > + delta /= nr_running; > > + } > > Is it possible to use (smt_count - core_occupation) / core_occupation > to evaluate this delta ?
Good point, we can use the pre-computed info here. This will help simplify this logic.
Thanks, Josh
| |