Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

kthread: Refine naming of affinity related fields

The kthreads preferred affinity related fields use "hotplug" as the base
of their naming because the affinity management was initially deemed to
deal with CPU hotplug.

The scope of this role is going to broaden now and also deal with
cpuset isolated partition updates.

Switch the naming accordingly.

Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
Acked-by: Waiman Long <longman@redhat.com>
Cc: Marco Crivellari <marco.crivellari@suse.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Tejun Heo <tj@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Waiman Long <longman@redhat.com>

+19 -19
+19 -19
kernel/kthread.c
··· 35 35 static LIST_HEAD(kthread_create_list); 36 36 struct task_struct *kthreadd_task; 37 37 38 - static LIST_HEAD(kthreads_hotplug); 39 - static DEFINE_MUTEX(kthreads_hotplug_lock); 38 + static LIST_HEAD(kthread_affinity_list); 39 + static DEFINE_MUTEX(kthread_affinity_lock); 40 40 41 41 struct kthread_create_info 42 42 { ··· 69 69 /* To store the full name if task comm is truncated. */ 70 70 char *full_name; 71 71 struct task_struct *task; 72 - struct list_head hotplug_node; 72 + struct list_head affinity_node; 73 73 struct cpumask *preferred_affinity; 74 74 }; 75 75 ··· 128 128 129 129 init_completion(&kthread->exited); 130 130 init_completion(&kthread->parked); 131 - INIT_LIST_HEAD(&kthread->hotplug_node); 131 + INIT_LIST_HEAD(&kthread->affinity_node); 132 132 p->vfork_done = &kthread->exited; 133 133 134 134 kthread->task = p; ··· 323 323 { 324 324 struct kthread *kthread = to_kthread(current); 325 325 kthread->result = result; 326 - if (!list_empty(&kthread->hotplug_node)) { 327 - mutex_lock(&kthreads_hotplug_lock); 328 - list_del(&kthread->hotplug_node); 329 - mutex_unlock(&kthreads_hotplug_lock); 326 + if (!list_empty(&kthread->affinity_node)) { 327 + mutex_lock(&kthread_affinity_lock); 328 + list_del(&kthread->affinity_node); 329 + mutex_unlock(&kthread_affinity_lock); 330 330 331 331 if (kthread->preferred_affinity) { 332 332 kfree(kthread->preferred_affinity); ··· 390 390 return; 391 391 } 392 392 393 - mutex_lock(&kthreads_hotplug_lock); 394 - WARN_ON_ONCE(!list_empty(&kthread->hotplug_node)); 395 - list_add_tail(&kthread->hotplug_node, &kthreads_hotplug); 393 + mutex_lock(&kthread_affinity_lock); 394 + WARN_ON_ONCE(!list_empty(&kthread->affinity_node)); 395 + list_add_tail(&kthread->affinity_node, &kthread_affinity_list); 396 396 /* 397 397 * The node cpumask is racy when read from kthread() but: 398 398 * - a racing CPU going down will either fail on the subsequent ··· 402 402 */ 403 403 kthread_fetch_affinity(kthread, affinity); 404 404 set_cpus_allowed_ptr(current, affinity); 405 - mutex_unlock(&kthreads_hotplug_lock); 405 + mutex_unlock(&kthread_affinity_lock); 406 406 407 407 free_cpumask_var(affinity); 408 408 } ··· 873 873 goto out; 874 874 } 875 875 876 - mutex_lock(&kthreads_hotplug_lock); 876 + mutex_lock(&kthread_affinity_lock); 877 877 cpumask_copy(kthread->preferred_affinity, mask); 878 - WARN_ON_ONCE(!list_empty(&kthread->hotplug_node)); 879 - list_add_tail(&kthread->hotplug_node, &kthreads_hotplug); 878 + WARN_ON_ONCE(!list_empty(&kthread->affinity_node)); 879 + list_add_tail(&kthread->affinity_node, &kthread_affinity_list); 880 880 kthread_fetch_affinity(kthread, affinity); 881 881 882 882 scoped_guard (raw_spinlock_irqsave, &p->pi_lock) 883 883 set_cpus_allowed_force(p, affinity); 884 884 885 - mutex_unlock(&kthreads_hotplug_lock); 885 + mutex_unlock(&kthread_affinity_lock); 886 886 out: 887 887 free_cpumask_var(affinity); 888 888 ··· 903 903 struct kthread *k; 904 904 int ret; 905 905 906 - guard(mutex)(&kthreads_hotplug_lock); 906 + guard(mutex)(&kthread_affinity_lock); 907 907 908 - if (list_empty(&kthreads_hotplug)) 908 + if (list_empty(&kthread_affinity_list)) 909 909 return 0; 910 910 911 911 if (!zalloc_cpumask_var(&affinity, GFP_KERNEL)) ··· 913 913 914 914 ret = 0; 915 915 916 - list_for_each_entry(k, &kthreads_hotplug, hotplug_node) { 916 + list_for_each_entry(k, &kthread_affinity_list, affinity_node) { 917 917 if (WARN_ON_ONCE((k->task->flags & PF_NO_SETAFFINITY) || 918 918 kthread_is_per_cpu(k->task))) { 919 919 ret = -EINVAL;