smpboot.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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. * @pre_unpark: Optional unpark function, called before the thread is
  25. * unparked (cpu online). This is not guaranteed to be
  26. * called on the target cpu of the thread. Careful!
  27. * @selfparking: Thread is not parked by the park function.
  28. * @thread_comm: The base name of the thread
  29. */
  30. struct smp_hotplug_thread {
  31. struct task_struct __percpu **store;
  32. struct list_head list;
  33. int (*thread_should_run)(unsigned int cpu);
  34. void (*thread_fn)(unsigned int cpu);
  35. void (*create)(unsigned int cpu);
  36. void (*setup)(unsigned int cpu);
  37. void (*cleanup)(unsigned int cpu, bool online);
  38. void (*park)(unsigned int cpu);
  39. void (*unpark)(unsigned int cpu);
  40. void (*pre_unpark)(unsigned int cpu);
  41. bool selfparking;
  42. cpumask_var_t cpumask;
  43. const char *thread_comm;
  44. };
  45. int smpboot_register_percpu_thread(struct smp_hotplug_thread *plug_thread);
  46. void smpboot_unregister_percpu_thread(struct smp_hotplug_thread *plug_thread);
  47. int smpboot_thread_schedule(void);
  48. int smpboot_update_cpumask_percpu_thread(struct smp_hotplug_thread *plug_thread,
  49. const struct cpumask *);
  50. #endif