Re: [PATCH 1/3] SCHEDULER: Add an interface for counting real utilization.

From: Thomas Gleixner
Date: Thu Sep 28 2023 - 20:32:03 EST


On Thu, Sep 28 2023 at 10:22, Xiaobing Li wrote:
> Since pelt takes the running time of the thread as utilization, and for
> some threads, although they are running, they are not actually
> processing any transactions and are in an idling state.
> our goal is to count the effective working time of the thread, so as to
> Calculate the true utilization of threads.

Sorry. I can't figure out from the above what you are trying to achieve
and which problem this is actualy solving.

> +void get_sqthread_util(struct task_struct *p)
> +{
> + struct task_struct **sqstat = kcpustat_this_cpu->sq_util;
> +
> + for (int i = 0; i < MAX_SQ_NUM; i++) {
> + if (sqstat[i] && (task_cpu(sqstat[i]) != task_cpu(p)
> + || sqstat[i]->__state == TASK_DEAD))
> + sqstat[i] = NULL;
> + }

This is unreadable.

> +
> + if (strncmp(p->comm, "iou-sqp", 7))
> + return;

You really want to do hard coded string parsing on every invocation of
this function, which happens at least once per tick, right?

What's so special about iou-sqp?

Nothing at all. It might be special for your particular workload but its
completely irrelevant to everyone else.

We are not adding random statistics to the hotpath just because.

Please come back once you have a proper justification for imposing this
On everyone which is not using iouring at all.

Thanks

tglx