Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef _LINUX_SMPBOOT_H
0003 #define _LINUX_SMPBOOT_H
0004 
0005 #include <linux/types.h>
0006 
0007 struct task_struct;
0008 /* Cookie handed to the thread_fn*/
0009 struct smpboot_thread_data;
0010 
0011 /**
0012  * struct smp_hotplug_thread - CPU hotplug related thread descriptor
0013  * @store:      Pointer to per cpu storage for the task pointers
0014  * @list:       List head for core management
0015  * @thread_should_run:  Check whether the thread should run or not. Called with
0016  *          preemption disabled.
0017  * @thread_fn:      The associated thread function
0018  * @create:     Optional setup function, called when the thread gets
0019  *          created (Not called from the thread context)
0020  * @setup:      Optional setup function, called when the thread gets
0021  *          operational the first time
0022  * @cleanup:        Optional cleanup function, called when the thread
0023  *          should stop (module exit)
0024  * @park:       Optional park function, called when the thread is
0025  *          parked (cpu offline)
0026  * @unpark:     Optional unpark function, called when the thread is
0027  *          unparked (cpu online)
0028  * @selfparking:    Thread is not parked by the park function.
0029  * @thread_comm:    The base name of the thread
0030  */
0031 struct smp_hotplug_thread {
0032     struct task_struct      * __percpu *store;
0033     struct list_head        list;
0034     int             (*thread_should_run)(unsigned int cpu);
0035     void                (*thread_fn)(unsigned int cpu);
0036     void                (*create)(unsigned int cpu);
0037     void                (*setup)(unsigned int cpu);
0038     void                (*cleanup)(unsigned int cpu, bool online);
0039     void                (*park)(unsigned int cpu);
0040     void                (*unpark)(unsigned int cpu);
0041     bool                selfparking;
0042     const char          *thread_comm;
0043 };
0044 
0045 int smpboot_register_percpu_thread(struct smp_hotplug_thread *plug_thread);
0046 
0047 void smpboot_unregister_percpu_thread(struct smp_hotplug_thread *plug_thread);
0048 
0049 #endif