From: Mani Tofigh <mt4022@columbia.edu>
To: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
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: Tue, 3 Nov 2026 16:19:23 -0500 [thread overview]
Message-ID: <cdbb5dac-210d-4c75-810f-2f99e22675ff@columbia.edu> (raw)
In-Reply-To: <20261103151525.Mu-hc07d@linutronix.de>
On 11/3/26 10:15 AM, Sebastian Andrzej Siewior wrote:
> Is this just the net_rps interface or was this used for a reproducer and
> the issue is different?
It's RPS, just because it was the easiest way to keep NET_RX pending on
one CPU from userspace. The issue is any softirq that keeps getting
raised while ksoftirqd is asked to park.
> 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.
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.
> My original issue were queued up irq-work items which were not handled
> due to the park request and couldn't be handled otherwise.
>
That still works, run_irq_workd() runs once and takes the whole
lazy_list before the thread parks.
> The suggested change is okay in principle restores the old behaviour
> where we did not care but run the work at least once.
>
>> Fixes: 4a3b51aab6e2 ("smpboot: Don't park the thread if work is pending")
>> Signed-off-by: Mani Tofigh <mt4022@columbia.edu>
>> ---
>> Reproducer: https://github.com/manitofigh/files/blob/main/linux-repros/ksoftpark.c
>> ---
>> kernel/smpboot.c | 5 ++++-
>> 1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/kernel/smpboot.c b/kernel/smpboot.c
>> index 3f60e8c6dd30..a2ddd10a8577 100644
>> --- 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.
Mani
prev parent reply other threads:[~2026-11-03 21:19 UTC|newest]
Thread overview: 3+ 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 [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=cdbb5dac-210d-4c75-810f-2f99e22675ff@columbia.edu \
--to=mt4022@columbia.edu \
--cc=bigeasy@linutronix.de \
--cc=linux-kernel@vger.kernel.org \
--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®