Re: [PATCH v5 4/5] sched/fair: Skip SIS domain scan if fully busy

From: Abel Wu
Date: Wed Sep 14 2022 - 23:11:25 EST


On 9/15/22 8:22 AM, Tim Chen wrote:
On Fri, 2022-09-09 at 13:53 +0800, Abel Wu wrote:
If a full domain scan failed, then no unoccupied cpus available
and the LLC is fully busy. In this case we'd better use cpus
more wisely, rather than wasting it trying to find an idle cpu
that probably not exist. The fully busy status will be cleared
when any cpu of that LLC goes idle and everything goes back to
normal again.

Make the has_idle_cores boolean hint more rich by turning it
into a state machine.

Signed-off-by: Abel Wu <wuyun.abel@xxxxxxxxxxxxx>
---
include/linux/sched/topology.h | 35 +++++++++++++++++-
kernel/sched/fair.c | 67 ++++++++++++++++++++++++++++------
2 files changed, 89 insertions(+), 13 deletions(-)

diff --git a/include/linux/sched/topology.h b/include/linux/sched/topology.h
index 816df6cc444e..cc6089765b64 100644
--- a/include/linux/sched/topology.h
+++ b/include/linux/sched/topology.h
@@ -77,10 +77,43 @@ extern int sched_domain_level_max;
struct sched_group;
+/*
+ * States of the sched-domain
+ *
+ * - sd_has_icores
+ * This state is only used in LLC domains to indicate worthy
+ * of a full scan in SIS due to idle cores available.
+ *
+ * - sd_has_icpus
+ * This state indicates that unoccupied (sched-idle/idle) cpus
+ * might exist in this domain. For the LLC domains it is the
+ * default state since these cpus are the main targets of SIS
+ * search, and is also used as a fallback state of the other
+ * states.
+ *
+ * - sd_is_busy
+ * This state indicates there are no unoccupied cpus in this

Suggest reword to

.. indicates that all cpus are occupied in this ...

OK, I will make a update in next version!

Thanks,
Abel