smpboot.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. * @setup: Optional setup function, called when the thread gets
  15. * operational the first time
  16. * @cleanup: Optional cleanup function, called when the thread
  17. * should stop (module exit)
  18. * @park: Optional park function, called when the thread is
  19. * parked (cpu offline)
  20. * @unpark: Optional unpark function, called when the thread is
  21. * unparked (cpu online)
  22. * @thread_comm: The base name of the thread
  23. */
  24. struct smp_hotplug_thread {
  25. struct task_struct __percpu **store;
  26. struct list_head list;
  27. int (*thread_should_run)(unsigned int cpu);
  28. void (*thread_fn)(unsigned int cpu);
  29. void (*setup)(unsigned int cpu);
  30. void (*cleanup)(unsigned int cpu, bool online);
  31. void (*park)(unsigned int cpu);
  32. void (*unpark)(unsigned int cpu);
  33. const char *thread_comm;
  34. };
  35. int smpboot_register_percpu_thread(struct smp_hotplug_thread *plug_thread);
  36. void smpboot_unregister_percpu_thread(struct smp_hotplug_thread *plug_thread);
  37. int smpboot_thread_schedule(void);
  38. #endif