mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: chenjinghuang <chenjinghuang2@huawei.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: "mingo@redhat.com" <mingo@redhat.com>,
	"juri.lelli@redhat.com" <juri.lelli@redhat.com>,
	"vincent.guittot@linaro.org" <vincent.guittot@linaro.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"bsegall@google.com" <bsegall@google.com>,
	"dietmar.eggemann@arm.com" <dietmar.eggemann@arm.com>,
	"rostedt@goodmis.org" <rostedt@goodmis.org>,
	"mgorman@suse.de" <mgorman@suse.de>,
	"vschneid@redhat.com" <vschneid@redhat.com>,
	"kprateek.nayak@amd.com" <kprateek.nayak@amd.com>,
	"chenl311@chinatelecom.cn" <chenl311@chinatelecom.cn>,
	"steve.sistare@oracle.com" <steve.sistare@oracle.com>
Subject: Re: [RFC PATCH v5 0/9] steal tasks to improve CPU utilization
Date: Sat, 28 Mar 2026 10:48:59 +0800	[thread overview]
Message-ID: <f0533b83-82d6-4ef4-8bd7-95a21bf24e8e@huawei.com> (raw)
In-Reply-To: <20260320085325.GM3738786@noisy.programming.kicks-ass.net>

On 3/20/2026 4:53 PM, Peter Zijlstra wrote:
> On Fri, Mar 20, 2026 at 05:59:11AM +0000, Chen Jinghuang wrote:
>> When a CPU has no more CFS tasks to run, and idle_balance() fails to
>> find a task, then attempt to steal a task from an overloaded CPU in the
>> same LLC. Maintain and use a bitmap of overloaded CPUs to efficiently
>> identify candidates.  To minimize search time, steal the first migratable
>> task that is found when the bitmap is traversed.  For fairness, search
>> for migratable tasks on an overloaded CPU in order of next to run.
> 
> This makes no sense. It is the task of newidle to get more work -- if
> that is failing for you, then we should fix that, not build a second way
> to get tasks.
> 
> 
> 
Hi Peter,

That is a very valid point. However, profiling data indicates that
newidle_balance() still incurs excessive scanning overhead. Sharing the
expensive tick balance path is becoming an issue on high-core-count
systems.

As highlighted in recent ILB threads, profiling sqlite on a 224-CPU
Sapphire Rapids shows:

https://lore.kernel.org/all/cover.1690273854.git.yu.c.chen@intel.com/

6.69%    0.09%  sqlite3     [kernel.kallsyms]   [k] newidle_balance 
5.39%    4.71%  sqlite3     [kernel.kallsyms]   [k] update_sd_lb_stats

Walking the sd hierarchy in update_sd_lb_stats alone consumes over 5% of
CPU cycles. If we spend all that time scanning just to pull a tiny,
short-lived task, the search overhead dwarfs the actual runtime. It's a net
loss.

To mitigate this cost, I'd like to check if you are open to these two
directions:

1.Goal: As Tim questioned in the thread above: 

"Do we always have to find the busiest group and pull from it? Would a
relatively busy group be enough?"

Instead of chasing absolute fairness, shouldn't newidle_balance()
prioritize fast task acquisition? A task-stealing mechanism can be
effective in this regard.

2.Refactoring: Instead of a standalone fix, we could track LLC overload in
sched_domain_shared and add a lightweight fast path atop newidle_balance(),
gated by rq->avg_idle.

Do you think refactoring along these lines to integrate into the existing
framework makes sense?

Thanks, Chen Jinghuang


  parent reply	other threads:[~2026-03-28  2:49 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-20  5:59 Chen Jinghuang
2026-03-20  5:59 ` [RFC PATCH v5 1/9] sched: Provide sparsemask, a reduced contention bitmap Chen Jinghuang
2026-03-20  5:59 ` [RFC PATCH v5 2/9] sched/topology: Provide hooks to allocate data shared per LLC Chen Jinghuang
2026-03-20  5:59 ` [RFC PATCH v5 3/9] sched/topology: Provide cfs_overload_cpus bitmap Chen Jinghuang
2026-03-20  5:59 ` [RFC PATCH v5 4/9] sched/fair: Dynamically update cfs_overload_cpus Chen Jinghuang
2026-03-24 13:56   ` kernel test robot
2026-03-20  5:59 ` [RFC PATCH v5 5/9] sched/fair: Hoist idle_stamp up from idle_balance Chen Jinghuang
2026-03-20  5:59 ` [RFC PATCH v5 6/9] sched/fair: Generalize the detach_task interface Chen Jinghuang
2026-03-20  5:59 ` [RFC PATCH v5 7/9] sched/fair: Provide can_migrate_task_llc Chen Jinghuang
2026-03-20  5:59 ` [RFC PATCH v5 8/9] sched/fair: Steal work from an overloaded CPU when CPU goes idle Chen Jinghuang
2026-03-20  5:59 ` [RFC PATCH v5 9/9] sched/fair: Provide idle search schedstats Chen Jinghuang
2026-03-20  8:53 ` [RFC PATCH v5 0/9] steal tasks to improve CPU utilization Peter Zijlstra
2026-03-27 13:54   ` Valentin Schneider
2026-03-28  2:48   ` chenjinghuang [this message]
2026-04-20  4:01     ` chenjinghuang

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=f0533b83-82d6-4ef4-8bd7-95a21bf24e8e@huawei.com \
    --to=chenjinghuang2@huawei.com \
    --cc=bsegall@google.com \
    --cc=chenl311@chinatelecom.cn \
    --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@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=steve.sistare@oracle.com \
    --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®