smpboot.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #ifndef _LINUX_SMPBOOT_H
  2. #define _LINUX_SMPBOOT_H
  3. #include <linux/types.h>
  4. struct task_struct;
  5. /* Cookie handed to the thread_fn*/
  6. struct smpboot_thread_data;
  7. /**
  8. * struct smp_hotplug_thread - CPU hotplug related thread descriptor
  9. * @store: Pointer to per cpu storage for the task pointers
  10. * @list: List head for core management
  11. * @thread_should_run: Check whether the thread should run or not. Called with
  12. * preemption disabled.
  13. * @thread_fn: The associated thread function
  14. * @create: Optional setup function, called when the thread gets
  15. * created (Not called from the thread context)
  16. * @setup: Optional setup function, called when the thread gets
  17. * operational the first time
  18. * @cleanup: Optional cleanup function, called when the thread
  19. * should stop (module exit)
  20. * @park: Optional park function, called when the thread is
  21. * parked (cpu offline)
  22. * @unpark: Optional unpark function, called when the thread is
  23. * unparked (cpu online)
  24. * @selfparking: Thread is not parked by the park function.
  25. * @thread_comm: The base name of the thread
  26. */
  27. struct smp_hotplug_thread {
  28. struct task_struct __percpu **store;
  29. struct list_head list;
  30. int (*thread_should_run)(unsigned int cpu);
  31. void (*thread_fn)(unsigned int cpu);
  32. void (*create)(unsigned int cpu);
  33. void (*setup)(unsigned int cpu);
  34. void (*cleanup)(unsigned int cpu, bool online);
  35. void (*park)(unsigned int cpu);
  36. void (*unpark)(unsigned int cpu);
  37. bool selfparking;
  38. const char *thread_comm;
  39. };
  40. int smpboot_register_percpu_thread(struct smp_hotplug_thread *plug_thread);
  41. void smpboot_unregister_percpu_thread(struct smp_hotplug_thread *plug_thread);
  42. int smpboot_thread_schedule(void);
  43. #endif