mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Frederic Weisbecker <frederic@kernel.org>
To: sheviks <sheviks@gmail.com>
Cc: Waiman Long <longman@redhat.com>, linux-kernel@vger.kernel.org
Subject: Re: [QUESTION/REGRESSION] Unbound kthreads scheduled on nohz_full CPUs after commit 041ee6f3727a
Date: Mon, 23 Mar 2026 22:31:56 +0100	[thread overview]
Message-ID: <acGxTFEu8rUxMgLu@pavilion.home> (raw)
In-Reply-To: <CAHD6eKTxwoYR2--x7+qFE12_bA_Zvo1E+orpqeoNuwWXazJq=A@mail.gmail.com>

Le Mon, Mar 23, 2026 at 10:00:32AM +0800, sheviks a écrit :
> Frederic Weisbecker <frederic@kernel.org> 於 2026年3月23日週一 上午6:33寫道:
> > Yes. The affinity is applied right after the first wake-up of the kthread.
> > And this wake-up is supposed to happen right after the kthread creation
> > because the only purpose of this first wake-up is to allow for calling
> > kthread_park(), kthread_bind() or kthread_affine_preferred() between
> > kthread_create() and wake_up_process().
> >
> > So I'm wondering why you're facing such an issue. Because by the time
> > you create cgroup isolated partitions, all kthreads should have performed
> > their first wake-up already.
> >
> > Which kthread did you observe after cgroup setting that didn't perform its
> > first wake-up?
> >
> 
> Thank you for the response. I have performed a more detailed
> observation to track the migration behavior of these kthreads over
> time.
> 
> Setup and Procedure:
> Booted with: nohz_full=1-7 rcu_nocbs=1-7 irqaffinity=0 (No isolcpus).
> Monitored kthreads on CPUs 1-7 using: ps -eLo cpuid,comm | grep -e
> COMM -e "^ *[1-7] " | grep -ve "/[1-7]$" -e "kworker/[1-7]:" -e nvme0q
> 
> Initially, there were 30 kthreads residing on CPUs 1-7 right after boot.
> Manually created /sys/fs/cgroup/isolated1.slice and configured
> cpuset.cpus.exclusive and cpuset.cpus.partition=isolated.
> 
> Migration Timeline:
> Within 1 minute: rcuog/0 and rcuog/4 migrated back to CPU 0.
> At 2 minutes: khungtaskd and jbd2/zram0-8 migrated.
> At 8 minutes: kthreadd migrated.
> At 17 minutes: pr/legacy migrated. The count dropped to 24 kthreads.
> After 9 hours: 24 kthreads remain on CPUs 1-7.
> 
> The 24 kthreads remaining on CPUs 1-7 after 9 hours:
> CPUID COMMAND
>     1 card0-crtc3
>     1 ksmd
>     1 scsi_eh_4
>     1 scsi_eh_9
>     3 pool_workqueue_release
>     4 card0-crtc0
>     4 kdevtmpfs
>     4 rcu_exp_gp_kthread_worker
>     4 scsi_eh_5
>     5 oom_reaper
>     5 rcub/0
>     5 scsi_eh_0
>     5 scsi_eh_1
>     5 scsi_eh_2
>     5 scsi_eh_8
>     6 kswapd0
>     6 psimon
>     6 scsi_eh_6
>     6 watchdogd
>     7 card0-crtc1
>     7 card0-crtc2
>     7 psimon
>     7 scsi_eh_3
>     7 scsi_eh_7

"ps -o cpuid" tells where the task is currently running or, if sleeping, where
it ran last.

The cpuids that belong to isolated CPUs you're observing on some kthreads are there
because those tasks have slept the whole time since the cpuset isolated
partition was created. Yet they have been correctly migrated to CPU 0 and that
will be displayed on "ps -o cpuid" the next time those kthreads are woken up.

Use taskset for more accurate information as to where a task is allowed to run.

Thanks.

-- 
Frederic Weisbecker
SUSE Labs

  reply	other threads:[~2026-03-23 21:31 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-21  4:44 sheviks
2026-03-22 16:04 ` Waiman Long
2026-03-22 17:48   ` sheviks
2026-03-22 21:18     ` Waiman Long
2026-03-23  4:58       ` sheviks
2026-03-23 21:36         ` Waiman Long
2026-03-24 10:05           ` sheviks
2026-03-22 22:33     ` Frederic Weisbecker
2026-03-23  2:00       ` sheviks
2026-03-23 21:31         ` Frederic Weisbecker [this message]
     [not found]           ` <CAHD6eKRA4K1bLk0YmFg0SfcUK8=Ybftn0PCE7eB65N0MUdObCw@mail.gmail.com>
2026-03-24 11:34             ` sheviks

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=acGxTFEu8rUxMgLu@pavilion.home \
    --to=frederic@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=longman@redhat.com \
    --cc=sheviks@gmail.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®