mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: K Prateek Nayak <kprateek.nayak@amd.com>
To: Vincent Guittot <vincent.guittot@linaro.org>, <mingo@redhat.com>,
	<peterz@infradead.org>, <juri.lelli@redhat.com>,
	<dietmar.eggemann@arm.com>, <rostedt@goodmis.org>,
	<bsegall@google.com>, <mgorman@suse.de>, <vschneid@redhat.com>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] sched/fair: Remove sd->nohz_idle
Date: Fri, 27 Feb 2026 23:02:57 +0530	[thread overview]
Message-ID: <47e242af-3797-4952-95a8-2c58fc65177d@amd.com> (raw)
In-Reply-To: <20260227164726.1330712-1-vincent.guittot@linaro.org>

Hello Vincent,

On 2/27/2026 10:17 PM, Vincent Guittot wrote:
> sd->nohz_idle is used to call once inc|dec of &sd->shared->nr_busy_cpus
> when entering or leaving idle state but the call to
> set_cpu_sd_state_idle|busy is already protected by rq->nohz_tick_stopped
> being already set or clear.
> 
> Remove the useless sd->nohz_idle field which equals !rq->nohz_tick_stopped.

I had looked at this recently and I believe the following is
possible with hotplug/cpuset:

    CPU0                                        CPU1
    ====                                        ====

  nohz_balance_enter_idle()
    atomic_dec(&sd->shared->nr_busy_cpus);
  ... /* Idle */
                                               /* Sched domains are rebuilt */
                                               atomic_set(&sd->shared->nr_busy_cpus, sd_weight);
                                               update_top_cache_domain(0 /* CPU0 */)
                                                 sd = highest_flag_domain(cpu, SD_SHARE_LLC);
                                                 rcu_assign_pointer(per_cpu(sd_llc, cpu), sd); /* For CPU0 */
  ... /* Exits idle */
  ...
  ... /* First tick hits */
  /* Exits idle; First tick hits */
  if (rq->nohz_tick_stopped) /* True */
     nohz_balance_exit_idle()
       set_cpu_sd_state_busy()
         atomic_inc(&sd->shared->nr_busy_cpus) /* !!! Crosses sd_weight !!! */


I feel this per-SD indicator is necessary to avoid this scenario.
Is it fixed in some other way that I haven't realised yet?

-- 
Thanks and Regards,
Prateek


  reply	other threads:[~2026-02-27 17:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-27 16:47 Vincent Guittot
2026-02-27 17:32 ` K Prateek Nayak [this message]
2026-03-03 15:00   ` Vincent Guittot

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=47e242af-3797-4952-95a8-2c58fc65177d@amd.com \
    --to=kprateek.nayak@amd.com \
    --cc=bsegall@google.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=juri.lelli@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --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®