Re: [PATCH 3/6] sched: Report the different kinds of imbalances in /proc/schedstat

From: Sapkal, Swapnil
Date: Thu Dec 19 2024 - 01:08:41 EST


Hello Peter,

Thanks for the review.

On 12/18/2024 5:10 PM, Peter Zijlstra wrote:
On Wed, Dec 18, 2024 at 04:36:26AM +0000, Swapnil Sapkal wrote:

+static void update_lb_imbalance_stat(struct lb_env *env, struct sched_domain *sd,
+ enum cpu_idle_type idle)
+{
+ switch (env->migration_type) {
+ case migrate_load:
+ schedstat_add(sd->lb_imbalance_load[idle], env->imbalance);
+ break;
+ case migrate_util:
+ schedstat_add(sd->lb_imbalance_util[idle], env->imbalance);
+ break;
+ case migrate_task:
+ schedstat_add(sd->lb_imbalance_task[idle], env->imbalance);
+ break;
+ case migrate_misfit:
+ schedstat_add(sd->lb_imbalance_misfit[idle], env->imbalance);
+ break;
+ }
+}


Can you please write that like:

if (!schedstat_enabled())
return;

switch () {
case ...
__schedstat_add();
}

It makes no sense to have 4 copies of schedstat_enabled() inside the
switch statement -- esp. since afaik the compilers aren't able to CSE
static keys :/

This makes sense. I will update this change in v2.

--
Thanks and Regards,
Swapnil