Messages in this thread | | | Date | Mon, 12 Dec 2022 13:41:52 -0800 | From | Ricardo Neri <> | Subject | Re: [PATCH v2 06/22] sched/fair: Collect load-balancing stats for IPC classes |
| |
On Wed, Dec 07, 2022 at 06:00:32PM +0100, Dietmar Eggemann wrote: > On 28/11/2022 14:20, Ricardo Neri wrote: > > [...] > > > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c > > index 224107278471..3a1d6c50a19b 100644 > > --- a/kernel/sched/fair.c > > +++ b/kernel/sched/fair.c > > @@ -9100,6 +9100,57 @@ group_type group_classify(unsigned int imbalance_pct, > > return group_has_spare; > > } > > > > +struct sg_lb_ipcc_stats { > > + int min_score; /* Min(score(rq->curr->ipcc)) */ > > + int min_ipcc; /* Min(rq->curr->ipcc) */ > > + long sum_score; /* Sum(score(rq->curr->ipcc)) */ > > +}; > > Wouldn't it be cleaner to put `min_score`, `min_ipcc` and `sum_score` > into `struct sg_lb_stats` next to `ipcc_score_{after, before}` under the > same #ifdef CONFIG_IPC_CLASSES?
Yes, that is a good observation. I initially wanted to hide these intermediate and only expose the end result ipcc_score_{after, before} to struct sg_lb_stats. I agree, it would look cleaner as you suggest. > > Looks like those IPCC stats would only be needed in the specific > condition under which update_sg_lb_stats_scores() is called?
True.
> > > +#ifdef CONFIG_IPC_CLASSES > > +static void init_rq_ipcc_stats(struct sg_lb_ipcc_stats *sgcs) > > +{ > > + *sgcs = (struct sg_lb_ipcc_stats) { > > + .min_score = INT_MAX, > > + }; > > +} > > + > > +/** Called only if cpu_of(@rq) is not idle and has tasks running. */ > > +static void update_sg_lb_ipcc_stats(struct sg_lb_ipcc_stats *sgcs, > > + struct rq *rq) > > +{ > > + struct task_struct *curr; > > + unsigned short ipcc; > > + int score; > > + > > + if (!sched_ipcc_enabled()) > > + return; > > + > > + curr = rcu_dereference(rq->curr); > > + if (!curr || (curr->flags & PF_EXITING) || is_idle_task(curr)) > > So the Idle task is excluded but RT, DL, (Stopper) tasks are not. Looks > weird if non-CFS tasks could influence CFS load-balancing. > AFAICS, RT and DL tasks could have p->ipcc != IPC_CLASS_UNCLASSIFIED?
Agreed. Perhaps I can also check for !(task_is_realtime()), which see seems to cover all these cases. > > [...]
| |