[PATCH v5 0/2] sched: Don't trigger misfit if affinity is restricted

From: Qais Yousef
Date: Sun Feb 04 2024 - 21:11:47 EST


Changes since v4:

* Store max_allowed_capacity in task_struct and populate it when
affinity changes to avoid iterating through the capacities list in the
fast path (Vincent)
* Use rq->rd->max_cpu_capacity which is updated after hotplug
operations to check biggest allowed capacity in the system.
* Undo the change to check_misfit_status() and improve the function to
avoid similar confusion in the future.
* Split the patches differently. Export the capacity list and sort it
is now patch 1, handling of affinity for misfit detection is patch 2.

Changes since v3:

* Update commit message of patch 2 to be less verbose

Changes since v2:

* Convert access of asym_cap_list to be rcu protected
* Add new patch to sort the list in descending order
* Move some declarations inside affinity check block
* Remove now redundant check against max_cpu_capacity in check_misfit_status()

Changes since v1:

* Use asym_cap_list (thanks Dietmar) to iterate instead of iterating
through every cpu which Vincent was concerned about.
* Use uclamped util to compare with capacity instead of util_fits_cpu()
when iterating through capcities (Dietmar).
* Update commit log with test results to better demonstrate the problem

v1 discussion: https://lore.kernel.org/lkml/20230820203429.568884-1-qyousef@xxxxxxxxxxx/
v2 discussion: https://lore.kernel.org/lkml/20231212154056.626978-1-qyousef@xxxxxxxxxxx/
v3 discussion: https://lore.kernel.org/lkml/20231231175218.510721-1-qyousef@xxxxxxxxxxx/
v4 discussion: https://lore.kernel.org/lkml/20240105222014.1025040-1-qyousef@xxxxxxxxxxx/

I will send another patch to prevent failures to handle misfit from increasing
load balance as it seemed from previous discussion this is desirable.

There was another problem discussed in v4 that can cause delayed misfit
handling that is still being debugged and investigated.

Thanks!

--
Qais Yousef

Qais Yousef (2):
sched/topology: Export asym_capacity_list
sched/fair: Check a task has a fitting cpu when updating misfit

include/linux/sched.h | 1 +
init/init_task.c | 1 +
kernel/sched/fair.c | 84 ++++++++++++++++++++++++++++++++---------
kernel/sched/sched.h | 14 +++++++
kernel/sched/topology.c | 43 ++++++++++++---------
5 files changed, 107 insertions(+), 36 deletions(-)

--
2.34.1