mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-22 18:32:14 +07:00
230ec93909
It makes the registration cheaper and simpler for the smpboot per-cpu kthread users that don't need to always update the cpumask after threads creation. [sfr@canb.auug.org.au: fix for allow passing the cpumask on per-cpu thread registration] Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com> Reviewed-by: Chris Metcalf <cmetcalf@ezchip.com> Reviewed-by: Thomas Gleixner <tglx@linutronix.de> Cc: Chris Metcalf <cmetcalf@ezchip.com> Cc: Don Zickus <dzickus@redhat.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Ulrich Obergfell <uobergfe@redhat.com> Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
66 lines
2.3 KiB
C
66 lines
2.3 KiB
C
#ifndef _LINUX_SMPBOOT_H
|
|
#define _LINUX_SMPBOOT_H
|
|
|
|
#include <linux/types.h>
|
|
|
|
struct task_struct;
|
|
/* Cookie handed to the thread_fn*/
|
|
struct smpboot_thread_data;
|
|
|
|
/**
|
|
* struct smp_hotplug_thread - CPU hotplug related thread descriptor
|
|
* @store: Pointer to per cpu storage for the task pointers
|
|
* @list: List head for core management
|
|
* @thread_should_run: Check whether the thread should run or not. Called with
|
|
* preemption disabled.
|
|
* @thread_fn: The associated thread function
|
|
* @create: Optional setup function, called when the thread gets
|
|
* created (Not called from the thread context)
|
|
* @setup: Optional setup function, called when the thread gets
|
|
* operational the first time
|
|
* @cleanup: Optional cleanup function, called when the thread
|
|
* should stop (module exit)
|
|
* @park: Optional park function, called when the thread is
|
|
* parked (cpu offline)
|
|
* @unpark: Optional unpark function, called when the thread is
|
|
* unparked (cpu online)
|
|
* @pre_unpark: Optional unpark function, called before the thread is
|
|
* unparked (cpu online). This is not guaranteed to be
|
|
* called on the target cpu of the thread. Careful!
|
|
* @cpumask: Internal state. To update which threads are unparked,
|
|
* call smpboot_update_cpumask_percpu_thread().
|
|
* @selfparking: Thread is not parked by the park function.
|
|
* @thread_comm: The base name of the thread
|
|
*/
|
|
struct smp_hotplug_thread {
|
|
struct task_struct __percpu **store;
|
|
struct list_head list;
|
|
int (*thread_should_run)(unsigned int cpu);
|
|
void (*thread_fn)(unsigned int cpu);
|
|
void (*create)(unsigned int cpu);
|
|
void (*setup)(unsigned int cpu);
|
|
void (*cleanup)(unsigned int cpu, bool online);
|
|
void (*park)(unsigned int cpu);
|
|
void (*unpark)(unsigned int cpu);
|
|
void (*pre_unpark)(unsigned int cpu);
|
|
cpumask_var_t cpumask;
|
|
bool selfparking;
|
|
const char *thread_comm;
|
|
};
|
|
|
|
int smpboot_register_percpu_thread_cpumask(struct smp_hotplug_thread *plug_thread,
|
|
const struct cpumask *cpumask);
|
|
|
|
static inline int
|
|
smpboot_register_percpu_thread(struct smp_hotplug_thread *plug_thread)
|
|
{
|
|
return smpboot_register_percpu_thread_cpumask(plug_thread,
|
|
cpu_possible_mask);
|
|
}
|
|
|
|
void smpboot_unregister_percpu_thread(struct smp_hotplug_thread *plug_thread);
|
|
int smpboot_update_cpumask_percpu_thread(struct smp_hotplug_thread *plug_thread,
|
|
const struct cpumask *);
|
|
|
|
#endif
|