mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Julia Lawall <julia.lawall@inria.fr>
To: Vincent Guittot <vincent.guittot@linaro.org>,
	 Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	 Dietmar Eggemann <dietmar.eggemann@arm.com>,
	Mel Gorman <mgorman@suse.de>,
	 K Prateek Nayak <kprateek.nayak@amd.com>,
	 linux-kernel <linux-kernel@vger.kernel.org>
Subject: softirq
Date: Wed, 26 Jun 2024 15:37:01 +1000 (AEST)	[thread overview]
Message-ID: <ef964f57-7c9d-aa77-c958-793c899dc4d9@inria.fr> (raw)

Hello,

I'm not sure to understand how soft irqs work.  I see the code:

open_softirq(SCHED_SOFTIRQ, sched_balance_softirq);

Intuitively, I would expect that sched_balance_softirq would be run by
ksoftirqd.  That is, I would expect ksoftirqd to be scheduled
(sched_switch event), then the various actions of sched_balance_softirq to
be executed, and the ksoftirqd to be unscheduled (another ksoftirqd)
event.

But in practice, I see the code of sched_balance_softirq being executed
by the idle task, before the ksoftirqd is scheduled (see core 40):

          <idle>-0     [040]  3611.432554: softirq_entry:        vec=7 [action=SCHED]
          <idle>-0     [040]  3611.432554: bputs:                sched_balance_softirq: starting nohz
          <idle>-0     [040]  3611.432554: bputs:                sched_balance_softirq: starting _nohz_idle_balance
          bt.B.x-12022 [047]  3611.432554: softirq_entry:        vec=1 [action=TIMER]
          <idle>-0     [040]  3611.432554: bputs:                _nohz_idle_balance.isra.0: searching for a cpu
          bt.B.x-12033 [003]  3611.432554: softirq_entry:        vec=7 [action=SCHED]
          <idle>-0     [040]  3611.432554: bputs:                sched_balance_softirq: ending _nohz_idle_balance
          bt.B.x-12052 [011]  3611.432554: softirq_entry:        vec=7 [action=SCHED]
          <idle>-0     [040]  3611.432554: bputs:                sched_balance_softirq: nohz returns true ending soft irq
          <idle>-0     [040]  3611.432554: softirq_exit:         vec=7 [action=SCHED]

For example, idle seems to be running the code in _nohz_idle_balance.

I updated the code of _nohz_idle_balance as follows:

trace_printk("searching for a cpu\n");
        for_each_cpu_wrap(balance_cpu,  nohz.idle_cpus_mask, this_cpu+1) {
                if (!idle_cpu(balance_cpu))
                        continue;
trace_printk("found an idle cpu\n");

It prints searching for a cpu, but not found an idle cpu, because the
ksoftirqd on the core's runqueue makes the core not idle.  This makes the
whole softirq seem fairly useless when the only idle core is the one
raising the soft irq.

This is all for the same scenario that I have discussed previously, where
there are two sockets and an overload of on thread on one and an underload
of on thread on the other, and all the thread have been marked by numa
balancing as preferring to be where they are.  Now I am trying Prateek's
patch series.

thanks,
julia

             reply	other threads:[~2024-06-26  5:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-26  5:37 Julia Lawall [this message]
2024-06-26 15:17 ` softirq Vincent Guittot
2024-06-26 21:07   ` softirq Julia Lawall
2024-06-27 14:13     ` softirq K Prateek Nayak
2024-06-27 15:25       ` softirq Vincent Guittot
2024-06-27 22:30         ` softirq 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=ef964f57-7c9d-aa77-c958-793c899dc4d9@inria.fr \
    --to=julia.lawall@inria.fr \
    --cc=dietmar.eggemann@arm.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=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®