From: "liukai (Y)" <liukai284@huawei.com>
To: "mingo@redhat.com" <mingo@redhat.com>,
"peterz@infradead.org" <peterz@infradead.org>,
"juri.lelli@redhat.com" <juri.lelli@redhat.com>,
"vincent.guittot@linaro.org" <vincent.guittot@linaro.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"tanghui (C)" <tanghui20@huawei.com>,
"Zhangqiao (2012 lab)" <zhangqiao22@huawei.com>,
"Chenhui (Judy)" <judy.chenhui@huawei.com>,
"'weiliang.qwl@antgroup.com'" <weiliang.qwl@antgroup.com>,
"'henry.hj@antgroup.com'" <henry.hj@antgroup.com>,
"'yanyan.yan@antgroup.com'" <yanyan.yan@antgroup.com>,
"'libang.li@antgroup.com'" <libang.li@antgroup.com>,
"liwei (JK)" <liwei728@huawei.com>
Subject: Trade-off between load_balance frequency and CPU utilization under high load
Date: Thu, 26 Dec 2024 02:09:33 +0000 [thread overview]
Message-ID: <f10ea4ddee5d4ad588ca5aba3c5afac6@huawei.com> (raw)
In-Reply-To: <0aab22639ee0476a9a942bc4b06ebbce@huawei.com>
In our performance experiments, by gradually increasing the CPU load, we
observed that under high load, the CPU utilization (node CPU) in kernel 6.6
is higher than in 4.19, reaching up to 4% higher. By capturing flame graph
data, we found that the total execution time of load_balance in kernel 6.6
is 18% longer than in 4.19.
Benchmark: specjbb // 6.6
index target QPS actual QPS RT pod CPU node CPU
1 60000 60004 0.73 5.06 14.97
2 120000 120074 0.79 10.22 29.67
3 180000 180866 0.87 16.00 45.91
4 240000 240091 0.92 21.69 62.94
Benchmark: specjbb // 4.19
index target QPS actual QPS RT pod CPU node CPU
1 60000 60004 0.72 4.86 14.81
2 120000 120074 0.79 9.69 29.52
3 180000 180870 0.83 14.57 42.72
4 240000 240074 0.90 19.55 58.59
we found that in kernel 6.6, the execution of load_balance is less costly.
Even under high load, the condition this_rq->avg_idle <
sd->max_newidle_lb_cost is still easily satisfied. As a result, compared to
kernel 4.19, load_balance is executed more frequently in 6.6, leading to
higher CPU utilization.
if (!READ_ONCE(this_rq->rd->overload) ||
(sd && this_rq->avg_idle < sd->max_newidle_lb_cost)) {
if (sd)
update_next_balance(sd, &next_balance);
rcu_read_unlock();
goto out;
}
We identified that the changes introduced by this patch
(https://lore.kernel.org/all/20211021095219.GG3891@suse.de/).
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -10895,8 +10895,7 @@ static int newidle_balance(struct rq *this_rq, struct rq_flags *rf)
rcu_read_lock();
sd = rcu_dereference_check_sched_domain(this_rq->sd);
- if (this_rq->avg_idle < sysctl_sched_migration_cost ||
- !READ_ONCE(this_rq->rd->overload) ||
+ if (!READ_ONCE(this_rq->rd->overload) ||
(sd && this_rq->avg_idle < sd->max_newidle_lb_cost)) {
if (sd)
this_rq->avg_idle < sysctl_sched_migration_cost can reduce the frequency of
load_balance under high load, is there any way to dynamically adjust the
execution of load_balance in high-load scenarios, in order to strike a
balance between maintaining good CPU utilization and avoiding unnecessary
load_balance executions?
parent reply other threads:[~2024-12-26 2:09 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <0aab22639ee0476a9a942bc4b06ebbce@huawei.com>]
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=f10ea4ddee5d4ad588ca5aba3c5afac6@huawei.com \
--to=liukai284@huawei.com \
--cc=henry.hj@antgroup.com \
--cc=judy.chenhui@huawei.com \
--cc=juri.lelli@redhat.com \
--cc=libang.li@antgroup.com \
--cc=linux-kernel@vger.kernel.org \
--cc=liwei728@huawei.com \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=tanghui20@huawei.com \
--cc=vincent.guittot@linaro.org \
--cc=weiliang.qwl@antgroup.com \
--cc=yanyan.yan@antgroup.com \
--cc=zhangqiao22@huawei.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox