lkml.org 
[lkml]   [2024]   [Aug]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH 12/19] kthread: Default affine kthread to its preferred NUMA node
From
On 8/7/24 18:02, Frederic Weisbecker wrote:
> Kthreads attached to a preferred NUMA node for their task structure
> allocation can also be assumed to run preferrably within that same node.
>
> A more precise affinity is usually notified by calling
> kthread_create_on_cpu() or kthread_bind[_mask]() before the first wakeup.
>
> For the others, a default affinity to the node is desired and sometimes
> implemented with more or less success when it comes to deal with hotplug
> events and nohz_full / CPU Isolation interactions:
>
> - kcompactd is affine to its node and handles hotplug but not CPU Isolation
> - kswapd is affine to its node and ignores hotplug and CPU Isolation
> - A bunch of drivers create their kthreads on a specific node and
> don't take care about affining further.
>
> Handle that default node affinity preference at the generic level
> instead, provided a kthread is created on an actual node and doesn't
> apply any specific affinity such as a given CPU or a custom cpumask to
> bind to before its first wake-up.
>
> This generic handling is aware of CPU hotplug events and CPU isolation
> such that:
>
> * When a housekeeping CPU goes up and is part of the node of a given
> kthread, it is added to its applied affinity set (and
> possibly the default last resort online housekeeping set is removed
> from the set).
>
> * When a housekeeping CPU goes down while it was part of the node of a
> kthread, it is removed from the kthread's applied
> affinity. The last resort is to affine the kthread to all online
> housekeeping CPUs.
>
> Signed-off-by: Frederic Weisbecker <frederic@kernel.org>

Acked-by: Vlastimil Babka <vbabka@suse.cz>


\
 
 \ /
  Last update: 2024-08-07 19:02    [from the cache]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and my Meterkast|Read the blog