cpuset.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. #ifndef _LINUX_CPUSET_H
  2. #define _LINUX_CPUSET_H
  3. /*
  4. * cpuset interface
  5. *
  6. * Copyright (C) 2003 BULL SA
  7. * Copyright (C) 2004 Silicon Graphics, Inc.
  8. *
  9. */
  10. #include <linux/sched.h>
  11. #include <linux/cpumask.h>
  12. #include <linux/nodemask.h>
  13. #ifdef CONFIG_CPUSETS
  14. extern int cpuset_init(void);
  15. extern void cpuset_init_smp(void);
  16. extern void cpuset_fork(struct task_struct *p);
  17. extern void cpuset_exit(struct task_struct *p);
  18. extern cpumask_t cpuset_cpus_allowed(const struct task_struct *p);
  19. void cpuset_init_current_mems_allowed(void);
  20. void cpuset_update_task_memory_state(void);
  21. #define cpuset_nodes_subset_current_mems_allowed(nodes) \
  22. nodes_subset((nodes), current->mems_allowed)
  23. int cpuset_zonelist_valid_mems_allowed(struct zonelist *zl);
  24. extern int cpuset_zone_allowed(struct zone *z, gfp_t gfp_mask);
  25. extern int cpuset_excl_nodes_overlap(const struct task_struct *p);
  26. #define cpuset_memory_pressure_bump() \
  27. do { \
  28. if (cpuset_memory_pressure_enabled) \
  29. __cpuset_memory_pressure_bump(); \
  30. } while (0)
  31. extern int cpuset_memory_pressure_enabled;
  32. extern void __cpuset_memory_pressure_bump(void);
  33. extern struct file_operations proc_cpuset_operations;
  34. extern char *cpuset_task_status_allowed(struct task_struct *task, char *buffer);
  35. #else /* !CONFIG_CPUSETS */
  36. static inline int cpuset_init(void) { return 0; }
  37. static inline void cpuset_init_smp(void) {}
  38. static inline void cpuset_fork(struct task_struct *p) {}
  39. static inline void cpuset_exit(struct task_struct *p) {}
  40. static inline cpumask_t cpuset_cpus_allowed(struct task_struct *p)
  41. {
  42. return cpu_possible_map;
  43. }
  44. static inline void cpuset_init_current_mems_allowed(void) {}
  45. static inline void cpuset_update_task_memory_state(void) {}
  46. #define cpuset_nodes_subset_current_mems_allowed(nodes) (1)
  47. static inline int cpuset_zonelist_valid_mems_allowed(struct zonelist *zl)
  48. {
  49. return 1;
  50. }
  51. static inline int cpuset_zone_allowed(struct zone *z, gfp_t gfp_mask)
  52. {
  53. return 1;
  54. }
  55. static inline int cpuset_excl_nodes_overlap(const struct task_struct *p)
  56. {
  57. return 1;
  58. }
  59. static inline void cpuset_memory_pressure_bump(void) {}
  60. static inline char *cpuset_task_status_allowed(struct task_struct *task,
  61. char *buffer)
  62. {
  63. return buffer;
  64. }
  65. #endif /* !CONFIG_CPUSETS */
  66. #endif /* _LINUX_CPUSET_H */