cpuset.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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 number_of_cpusets; /* How many cpusets are defined in system? */
  15. extern int cpuset_init(void);
  16. extern void cpuset_init_smp(void);
  17. extern void cpuset_fork(struct task_struct *p);
  18. extern void cpuset_exit(struct task_struct *p);
  19. extern cpumask_t cpuset_cpus_allowed(struct task_struct *p);
  20. extern nodemask_t cpuset_mems_allowed(struct task_struct *p);
  21. void cpuset_init_current_mems_allowed(void);
  22. void cpuset_update_task_memory_state(void);
  23. #define cpuset_nodes_subset_current_mems_allowed(nodes) \
  24. nodes_subset((nodes), current->mems_allowed)
  25. int cpuset_zonelist_valid_mems_allowed(struct zonelist *zl);
  26. extern int __cpuset_zone_allowed(struct zone *z, gfp_t gfp_mask);
  27. static int inline cpuset_zone_allowed(struct zone *z, gfp_t gfp_mask)
  28. {
  29. return number_of_cpusets <= 1 || __cpuset_zone_allowed(z, gfp_mask);
  30. }
  31. extern int cpuset_excl_nodes_overlap(const struct task_struct *p);
  32. #define cpuset_memory_pressure_bump() \
  33. do { \
  34. if (cpuset_memory_pressure_enabled) \
  35. __cpuset_memory_pressure_bump(); \
  36. } while (0)
  37. extern int cpuset_memory_pressure_enabled;
  38. extern void __cpuset_memory_pressure_bump(void);
  39. extern struct file_operations proc_cpuset_operations;
  40. extern char *cpuset_task_status_allowed(struct task_struct *task, char *buffer);
  41. #else /* !CONFIG_CPUSETS */
  42. static inline int cpuset_init(void) { return 0; }
  43. static inline void cpuset_init_smp(void) {}
  44. static inline void cpuset_fork(struct task_struct *p) {}
  45. static inline void cpuset_exit(struct task_struct *p) {}
  46. static inline cpumask_t cpuset_cpus_allowed(struct task_struct *p)
  47. {
  48. return cpu_possible_map;
  49. }
  50. static inline nodemask_t cpuset_mems_allowed(struct task_struct *p)
  51. {
  52. return node_possible_map;
  53. }
  54. static inline void cpuset_init_current_mems_allowed(void) {}
  55. static inline void cpuset_update_task_memory_state(void) {}
  56. #define cpuset_nodes_subset_current_mems_allowed(nodes) (1)
  57. static inline int cpuset_zonelist_valid_mems_allowed(struct zonelist *zl)
  58. {
  59. return 1;
  60. }
  61. static inline int cpuset_zone_allowed(struct zone *z, gfp_t gfp_mask)
  62. {
  63. return 1;
  64. }
  65. static inline int cpuset_excl_nodes_overlap(const struct task_struct *p)
  66. {
  67. return 1;
  68. }
  69. static inline void cpuset_memory_pressure_bump(void) {}
  70. static inline char *cpuset_task_status_allowed(struct task_struct *task,
  71. char *buffer)
  72. {
  73. return buffer;
  74. }
  75. #endif /* !CONFIG_CPUSETS */
  76. #endif /* _LINUX_CPUSET_H */