From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: Mani Tofigh <mt4022@columbia.edu>
Cc: Thomas Gleixner <tglx@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
linux-kernel@vger.kernel.org, tz2294@columbia.edu
Subject: Re: [PATCH] smpboot: Run the thread function only once before parking
Date: Wed, 4 Nov 2026 08:44:58 +0100 [thread overview]
Message-ID: <20261104074458.J7ugpo2w@linutronix.de> (raw)
In-Reply-To: <cdbb5dac-210d-4c75-810f-2f99e22675ff@columbia.edu>
On 2026-11-03 16:19:23 [-0500], Mani Tofigh wrote:
> > Would avoid it. On the other hand networking has HP-handler which
> > ensures that the queues of the offlined CPU are handled.
>
> True, cpu_active() is the better check there (and the RFS check a few
> lines up probably wants the same). I'm happy to send that to netdev
> separately.
No, I don't think it is needed.
> It only covers RPS though. A NIC IRQ still affine to that CPU, or a
> tasklet that's scheduled while disabled, keeps ksoftirqd busy the same
> way. So I'd keep the smpboot change and do the get_rps_cpu() one on top.
softirq/ ksoftirqd have an abort criteria so they don't run for too
long. If you manage to come up with a case that softirq/NET_RX
processing stalls the CPU bring down then we can think about it.
Otherwise I wouldn't bother.
> > > --- a/kernel/smpboot.c
> > > +++ b/kernel/smpboot.c
> > > @@ -119,9 +119,12 @@ static int smpboot_thread_fn(void *data)
> > > }
> > > should_run = td->status == HP_THREAD_ACTIVE && ht->thread_should_run(td->cpu);
> > > - if (kthread_should_park() && !should_run) {
> > > + if (kthread_should_park()) {
> > > __set_current_state(TASK_RUNNING);
> > > preempt_enable();
> > > + /* Run pending work once, new work may keep coming */
> > /*
> > * Run pending work once to handle queued work prior the parking
> > * request. Don't try to process everything in case new work
> > * continues to come and the handler has a hotplug notifier for
> > * everything that was enqueued later.
> > */
>
> Thanks! I will use that in v2.
>
> > The thread_fn should only run in HP_THREAD_ACTIVE case.
> >
> It does already, should_run includes td->status == HP_THREAD_ACTIVE.
Ach, indeed. Then it looks fine.
> Mani
Sebastian
prev parent reply other threads:[~2026-11-04 7:45 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-02 21:51 Mani Tofigh via B4 Relay
2026-11-03 15:15 ` Sebastian Andrzej Siewior
2026-11-03 21:19 ` Mani Tofigh
2026-11-04 7:44 ` Sebastian Andrzej Siewior [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=20261104074458.J7ugpo2w@linutronix.de \
--to=bigeasy@linutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=mt4022@columbia.edu \
--cc=peterz@infradead.org \
--cc=tglx@kernel.org \
--cc=tz2294@columbia.edu \
/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®