From: Jianyong Wu <wujianyong@hygon.cn>
To: "peterz@infradead.org" <peterz@infradead.org>,
"mingo@redhat.com" <mingo@redhat.com>,
"juri.lelli@redhat.com" <juri.lelli@redhat.com>,
"vincent.guittot@linaro.org" <vincent.guittot@linaro.org>
Cc: "dietmar.eggemann@arm.com" <dietmar.eggemann@arm.com>,
"rostedt@goodmis.org" <rostedt@goodmis.org>,
"bsegall@google.com" <bsegall@google.com>,
"mgorman@suse.de" <mgorman@suse.de>,
"vschneid@redhat.com" <vschneid@redhat.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"jianyong.wu@outlook.com" <jianyong.wu@outlook.com>,
Yibin Liu <liuyibin@hygon.cn>
Subject: RE: [PATCH v2] sched/core: avoid calling select_task_rq cb if bound to one CPU for exec
Date: Mon, 12 Jan 2026 08:03:47 +0000 [thread overview]
Message-ID: <aced0e93c0d94d6b94eb576f884a44f8@hygon.cn> (raw)
In-Reply-To: <20251201105545.778087-1-wujianyong@hygon.cn>
Gentle ping. :)
> -----Original Message-----
> From: Jianyong Wu <wujianyong@hygon.cn>
> Sent: Monday, December 1, 2025 6:56 PM
> To: peterz@infradead.org; mingo@redhat.com; juri.lelli@redhat.com;
> vincent.guittot@linaro.org
> Cc: dietmar.eggemann@arm.com; rostedt@goodmis.org;
> bsegall@google.com; mgorman@suse.de; vschneid@redhat.com;
> linux-kernel@vger.kernel.org; jianyong.wu@outlook.com; Jianyong Wu
> <wujianyong@hygon.cn>; Yibin Liu <liuyibin@hygon.cn>
> Subject: [PATCH v2] sched/core: avoid calling select_task_rq cb if bound to
> one CPU for exec
>
> In the current implementation, even if the task calling execl is bound to a
> single CPU (or not allowed to be migrated), it still invokes the
> select_task_rq callback to select a CPU. This is unnecessary and wastes
> cycles.
>
> Since select_task_rq() already includes checks for the above scenarios (e.g.,
> tasks bound to a single CPU or forbidden to migrate) and skips the
> select_task_rq callback in such cases, we can directly use
> select_task_rq() instead of invoking the callback here.
>
> Test environment: 256-CPU X86 server
> Test method: Run unixbench's execl test with task bound to a single CPU:
>
> $ numactl -C 10 ./Run execl -c 1
>
> Test results: Average of 5 runs
>
> baseline patched improvement
> 383.82 436.78 +13.8%
>
> Change Log:
>
> v1->v2
> As suggested by Peter, replace manual corner-case checks with
> select_task_rq() to align with existing logic.
>
> Additional testing on a 256-CPU server which all sched domains have
> SD_BALANCE_EXEC flag, shows that sched_exec now searches all CPUs in
> the system (previously, some SD_NUMA sched domains lacked
> SD_BALANCE_EXEC).
> This increased the performance improvement to 13.8%.
>
> Suggested-by: Peter Zijlstra <peterz@infradead.org>
> Co-developed-by: Yibin Liu <liuyibin@hygon.cn>
> Signed-off-by: Yibin Liu <liuyibin@hygon.cn>
> Signed-off-by: Jianyong Wu <wujianyong@hygon.cn>
> ---
> kernel/sched/core.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c index
> f754a60de848..6e4ba3c27e5c 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -5439,10 +5439,11 @@ void sched_exec(void) {
> struct task_struct *p = current;
> struct migration_arg arg;
> - int dest_cpu;
> + int dest_cpu, wake_flag = WF_EXEC;
>
> scoped_guard (raw_spinlock_irqsave, &p->pi_lock) {
> - dest_cpu = p->sched_class->select_task_rq(p, task_cpu(p),
> WF_EXEC);
> + dest_cpu = select_task_rq(p, task_cpu(p), &wake_flag);
> +
> if (dest_cpu == smp_processor_id())
> return;
>
> --
> 2.43.0
prev parent reply other threads:[~2026-01-12 8:24 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-01 10:55 Jianyong Wu
2026-01-12 8:03 ` Jianyong Wu [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=aced0e93c0d94d6b94eb576f884a44f8@hygon.cn \
--to=wujianyong@hygon.cn \
--cc=bsegall@google.com \
--cc=dietmar.eggemann@arm.com \
--cc=jianyong.wu@outlook.com \
--cc=juri.lelli@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=liuyibin@hygon.cn \
--cc=mgorman@suse.de \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®