From: Julia Lawall <julia.lawall@inria.fr>
To: Vincent Guittot <vincent.guittot@linaro.org>
Cc: Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
Dietmar Eggemann <dietmar.eggemann@arm.com>,
Mel Gorman <mgorman@suse.de>,
linux-kernel@vger.kernel.org
Subject: Re: EEVDF and NUMA balancing
Date: Thu, 4 Jan 2024 17:45:02 +0100 (CET) [thread overview]
Message-ID: <8daf59ab-5f73-1f3-251e-bb9cc72a598@inria.fr> (raw)
In-Reply-To: <CAKfTPtCAcHuzhcDvry6_nH2K29wc-LEo2yOi-J-mnZkwMvGDbw@mail.gmail.com>
On Thu, 4 Jan 2024, Vincent Guittot wrote:
> On Fri, 29 Dec 2023 at 16:18, Julia Lawall <julia.lawall@inria.fr> wrote:
> >
> >
> >
> > On Thu, 28 Dec 2023, Julia Lawall wrote:
> >
> > > > > > > > > I'm surprised that you have mainly CPU_NEWLY_IDLE. Do you know the reason ?
> > > > > > > >
> > > > > > > > No. They come from do_idle calling the scheduler. I will look into why
> > > > > > > > this happens so often.
> > > > > > >
> > > > > > > Hmm, the CPU was idle and received a need resched which triggered the
> > > > > > > scheduler but there was nothing to schedule so it goes back to idle
> > > > > > > after running a newly_idle _load_balance.
> > > > > >
> > > > > > I spent quite some time thinking the same until I saw the following code
> > > > > > in do_idle:
> > > > > >
> > > > > > preempt_set_need_resched();
> > > > > >
> > > > > > So I have the impression that do_idle sets need resched itself.
> > > > >
> > > > > But of course that code is only executed if need_resched is true. But I
> > > >
> > > > Yes, that is your root cause. something, most probably in interrupt
> > > > context, wakes up your CPU and expect to wake up a thread
> > > >
> > > > > don't know who would be setting need resched on each clock tick.
> > > >
> > > > that can be a timer, interrupt, ipi, rcu ...
> > > > a trace should give you some hints
> > >
> > > I have the impression that it is the goal of calling nohz_csd_func on each
> > > clock tick that causes the calls to need_resched. If the idle process is
> > > polling, call_function_single_prep_ipi just sets need_resched to get the
>
> Your system is calling the polling mode and not the default
> cpuidle_idle_call() ? This could explain why I don't see such problem
> on my system which doesn't have polling
>
> Are you forcing the use of polling mode ?
> If yes, could you check that this problem disappears without forcing
> polling mode ?
I'll check. I didn't explicitly set anything, but I don't really know
what my configuration file does.
>
> > > idle process to stop polling. But there is no actual task that the idle
> > > process should schedule. The need_resched then prevents the idle process
> > > from stealing, due to the CPU_NEWLY_IDLE flag, contradicting the whole
> > > purpose of calling nohz_csd_func in the first place.
>
> Do I understand correctly that your sequence is :
> CPU A CPU B
> cpu enters idle
> do_idle()
> ...
> loop in cpu_idle_poll
> ...
> kick_ilb on CPU A
> send_call_function_single_ipi
> set_nr_if_polling
> set TIF_NEED_RESCHED
>
> exit polling loop
> exit while (!need_resched())
>
> call nohz_csd_func but
> need_resched is true so it's a nope
>
> pick_next_task_fair
> newidle_balance
> load_balance(CPU_NEWLY_IDLE)
Yes, this looks correct.
thanks,
julia
>
> >
> > Looking in more detail, do_idle contains the following after existing the
> > polling loop:
> >
> > flush_smp_call_function_queue();
> > schedule_idle();
> >
> > flush_smp_call_function_queue() does end up calling nohz_csd_func, but
> > this has no impact, because it first checks that need_resched() is false,
> > whereas it is currently true to cause existing the polling loop. Removing
> > that test causes:
> >
> > raise_softirq_irqoff(SCHED_SOFTIRQ);
> >
> > but that causes the load balancing code to be executed from a ksoftirqd
> > task, which means that there is now no load imbalance.
> >
> > So the only chance to detect an imbalance does seem to be to have the load
> > balance call be executed by the idle task, via schedule_idle(), as is
> > done currently. But that leads to the core being considered to be newly
> > idle.
> >
> > julia
> >
> >
>
next prev parent reply other threads:[~2024-01-04 16:45 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-03 20:25 Julia Lawall
2023-10-03 21:51 ` Peter Zijlstra
2023-10-04 12:01 ` Julia Lawall
2023-10-04 12:05 ` Peter Zijlstra
2023-10-04 16:24 ` Julia Lawall
2023-10-04 17:48 ` Peter Zijlstra
2023-10-04 18:04 ` Julia Lawall
2023-10-09 10:29 ` Peter Zijlstra
2023-10-09 14:07 ` Julia Lawall
2023-11-11 12:56 ` Julia Lawall
2023-12-18 13:58 ` Julia Lawall
2023-12-18 17:18 ` Vincent Guittot
2023-12-18 22:31 ` Julia Lawall
2023-12-19 17:38 ` Vincent Guittot
2023-12-19 17:51 ` Julia Lawall
2023-12-20 17:09 ` Vincent Guittot
2023-12-21 18:20 ` Julia Lawall
2023-12-22 14:55 ` Vincent Guittot
2023-12-22 15:00 ` Julia Lawall
2023-12-22 15:59 ` Vincent Guittot
2023-12-22 16:18 ` Julia Lawall
2023-12-22 16:29 ` Julia Lawall
2023-12-22 16:42 ` Vincent Guittot
2023-12-28 18:34 ` Julia Lawall
2023-12-29 15:18 ` Julia Lawall
2024-01-04 16:26 ` Vincent Guittot
2024-01-04 16:45 ` Julia Lawall [this message]
2024-01-05 14:51 ` Julia Lawall
2024-01-05 16:00 ` Vincent Guittot
2024-01-05 16:39 ` Julia Lawall
2024-01-05 17:27 ` Julia Lawall
2024-01-18 16:35 ` Vincent Guittot
2024-01-18 16:50 ` Julia Lawall
2024-01-18 17:10 ` Vincent Guittot
2024-01-18 17:43 ` Julia Lawall
2024-01-18 22:13 ` Julia Lawall
2024-01-19 11:26 ` Vincent Guittot
2024-01-19 11:33 ` Julia Lawall
2024-01-26 21:20 ` Julia Lawall
2024-03-10 9:39 ` Julia Lawall
2024-01-05 20:45 ` Julia Lawall
2023-12-20 16:39 ` Julia Lawall
2023-12-20 17:11 ` Vincent Guittot
2023-10-04 18:15 ` Ingo Molnar
2023-10-04 18:20 ` Julia Lawall
2023-10-04 19:48 ` Julia Lawall
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=8daf59ab-5f73-1f3-251e-bb9cc72a598@inria.fr \
--to=julia.lawall@inria.fr \
--cc=dietmar.eggemann@arm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=vincent.guittot@linaro.org \
/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®