From: Srikar Dronamraju <srikar@linux.ibm.com>
To: Ingo Molnar <mingo@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
Juri Lelli <juri.lelli@redhat.com>,
Vincent Guittot <vincent.guittot@linaro.org>,
Dietmar Eggemann <dietmar.eggemann@arm.com>,
Steven Rostedt <rostedt@goodmis.org>,
Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
Valentin Schneider <vschneid@redhat.com>,
K Prateek Nayak <kprateek.nayak@amd.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
Srikar Dronamraju <srikar@linux.ibm.com>
Subject: [PATCH 3/3] sched/topology: Simplify cache_nice_tries initialization
Date: Fri, 20 Nov 2026 07:19:50 +0530 [thread overview]
Message-ID: <20261120014946.1355234-8-srikar@linux.ibm.com> (raw)
In-Reply-To: <20261120014946.1355234-5-srikar@linux.ibm.com>
sched_domain initialization currently starts with cache_nice_tries = 0
and later updates it based on the domain type. Most sched domains
eventually end up with cache_nice_tries set to 1, with LLC-sharing
domains and most non-NUMA domains explicitly overriding the initial
value.
As a result, the current code initializes cache_nice_tries to a value
that is not the common case and subsequently reassigns it during domain
setup.
The only domain type that retains a value of 0 is a
SD_SHARE_CPUCAPACITY domain, while NUMA domains use a value of 2 and
most remaining domains use a value of 1.
Initialize cache_nice_tries to 1 by default and only override it for
the special cases that require a different value. This reduces the
number of assignments required during sched-domain construction and
makes the resulting configuration easier to follow.
No functional change is intended. The resulting values remain unchanged:
SD_SHARE_CPUCAPACITY : 0
SD_SHARE_LLC : 1
other non-NUMA : 1
SD_NUMA : 2
Signed-off-by: Srikar Dronamraju <srikar@linux.ibm.com>
---
kernel/sched/topology.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c
index 99878da03bce..da4f1e127341 100644
--- a/kernel/sched/topology.c
+++ b/kernel/sched/topology.c
@@ -1979,7 +1979,7 @@ sd_init(struct sched_domain_topology_level *tl,
.busy_factor = 16,
.imbalance_pct = 117,
- .cache_nice_tries = 0,
+ .cache_nice_tries = 1,
.flags = 1*SD_BALANCE_NEWIDLE
| 1*SD_BALANCE_EXEC
@@ -2018,10 +2018,7 @@ sd_init(struct sched_domain_topology_level *tl,
*/
if (sd->flags & SD_SHARE_CPUCAPACITY) {
sd->imbalance_pct = 110;
-
- } else if (sd->flags & SD_SHARE_LLC) {
- sd->imbalance_pct = 117;
- sd->cache_nice_tries = 1;
+ sd->cache_nice_tries = 0;
#ifdef CONFIG_NUMA
} else if (sd->flags & SD_NUMA) {
@@ -2036,8 +2033,6 @@ sd_init(struct sched_domain_topology_level *tl,
}
#endif /* CONFIG_NUMA */
- } else {
- sd->cache_nice_tries = 1;
}
sd->private = sdd;
--
2.55.0
prev parent reply other threads:[~2026-11-20 1:50 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-20 1:49 [PATCH 0/3] sched: Fix load accounting and improve imbalance calculation Srikar Dronamraju
2026-11-20 1:49 ` [PATCH 1/3] sched/fair: Exclude delayed-dequeued tasks from sum_nr_running Srikar Dronamraju
2026-11-20 10:54 ` Peter Zijlstra
2026-11-20 10:59 ` Peter Zijlstra
2026-11-20 1:49 ` [PATCH 2/3] sched/fair: Use runnable task imbalance for asymmetric groups Srikar Dronamraju
2026-11-20 1:49 ` Srikar Dronamraju [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261120014946.1355234-8-srikar@linux.ibm.com \
--to=srikar@linux.ibm.com \
--cc=bsegall@google.com \
--cc=dietmar.eggemann@arm.com \
--cc=juri.lelli@redhat.com \
--cc=kprateek.nayak@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mgorman@suse.de \
--cc=mingo@kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=vincent.guittot@linaro.org \
--cc=vschneid@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.