spi: takes size of a pointer to determine the size of the pointed-to type
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / include / linux / cpuset.h
blob05ea1dd7d681d072a5ae1c9c7c2da56d75bbc6e6
1 #ifndef _LINUX_CPUSET_H
2 #define _LINUX_CPUSET_H
3 /*
4 * cpuset interface
6 * Copyright (C) 2003 BULL SA
7 * Copyright (C) 2004-2006 Silicon Graphics, Inc.
9 */
11 #include <linux/sched.h>
12 #include <linux/cpumask.h>
13 #include <linux/nodemask.h>
14 #include <linux/cgroup.h>
15 #include <linux/mm.h>
17 #ifdef CONFIG_CPUSETS
19 extern int number_of_cpusets; /* How many cpusets are defined in system? */
21 extern int cpuset_init_early(void);
22 extern int cpuset_init(void);
23 extern void cpuset_init_smp(void);
24 extern void cpuset_cpus_allowed(struct task_struct *p, struct cpumask *mask);
25 extern void cpuset_cpus_allowed_locked(struct task_struct *p,
26 struct cpumask *mask);
27 extern nodemask_t cpuset_mems_allowed(struct task_struct *p);
28 #define cpuset_current_mems_allowed (current->mems_allowed)
29 void cpuset_init_current_mems_allowed(void);
30 void cpuset_update_task_memory_state(void);
31 int cpuset_nodemask_valid_mems_allowed(nodemask_t *nodemask);
33 extern int __cpuset_node_allowed_softwall(int node, gfp_t gfp_mask);
34 extern int __cpuset_node_allowed_hardwall(int node, gfp_t gfp_mask);
36 static inline int cpuset_node_allowed_softwall(int node, gfp_t gfp_mask)
38 return number_of_cpusets <= 1 ||
39 __cpuset_node_allowed_softwall(node, gfp_mask);
42 static inline int cpuset_node_allowed_hardwall(int node, gfp_t gfp_mask)
44 return number_of_cpusets <= 1 ||
45 __cpuset_node_allowed_hardwall(node, gfp_mask);
48 static inline int cpuset_zone_allowed_softwall(struct zone *z, gfp_t gfp_mask)
50 return cpuset_node_allowed_softwall(zone_to_nid(z), gfp_mask);
53 static inline int cpuset_zone_allowed_hardwall(struct zone *z, gfp_t gfp_mask)
55 return cpuset_node_allowed_hardwall(zone_to_nid(z), gfp_mask);
58 extern int cpuset_mems_allowed_intersects(const struct task_struct *tsk1,
59 const struct task_struct *tsk2);
61 #define cpuset_memory_pressure_bump() \
62 do { \
63 if (cpuset_memory_pressure_enabled) \
64 __cpuset_memory_pressure_bump(); \
65 } while (0)
66 extern int cpuset_memory_pressure_enabled;
67 extern void __cpuset_memory_pressure_bump(void);
69 extern const struct file_operations proc_cpuset_operations;
70 struct seq_file;
71 extern void cpuset_task_status_allowed(struct seq_file *m,
72 struct task_struct *task);
74 extern void cpuset_lock(void);
75 extern void cpuset_unlock(void);
77 extern int cpuset_mem_spread_node(void);
79 static inline int cpuset_do_page_mem_spread(void)
81 return current->flags & PF_SPREAD_PAGE;
84 static inline int cpuset_do_slab_mem_spread(void)
86 return current->flags & PF_SPREAD_SLAB;
89 extern int current_cpuset_is_being_rebound(void);
91 extern void rebuild_sched_domains(void);
93 extern void cpuset_print_task_mems_allowed(struct task_struct *p);
95 #else /* !CONFIG_CPUSETS */
97 static inline int cpuset_init_early(void) { return 0; }
98 static inline int cpuset_init(void) { return 0; }
99 static inline void cpuset_init_smp(void) {}
101 static inline void cpuset_cpus_allowed(struct task_struct *p,
102 struct cpumask *mask)
104 cpumask_copy(mask, cpu_possible_mask);
106 static inline void cpuset_cpus_allowed_locked(struct task_struct *p,
107 struct cpumask *mask)
109 cpumask_copy(mask, cpu_possible_mask);
112 static inline nodemask_t cpuset_mems_allowed(struct task_struct *p)
114 return node_possible_map;
117 #define cpuset_current_mems_allowed (node_states[N_HIGH_MEMORY])
118 static inline void cpuset_init_current_mems_allowed(void) {}
119 static inline void cpuset_update_task_memory_state(void) {}
121 static inline int cpuset_nodemask_valid_mems_allowed(nodemask_t *nodemask)
123 return 1;
126 static inline int cpuset_node_allowed_softwall(int node, gfp_t gfp_mask)
128 return 1;
131 static inline int cpuset_node_allowed_hardwall(int node, gfp_t gfp_mask)
133 return 1;
136 static inline int cpuset_zone_allowed_softwall(struct zone *z, gfp_t gfp_mask)
138 return 1;
141 static inline int cpuset_zone_allowed_hardwall(struct zone *z, gfp_t gfp_mask)
143 return 1;
146 static inline int cpuset_mems_allowed_intersects(const struct task_struct *tsk1,
147 const struct task_struct *tsk2)
149 return 1;
152 static inline void cpuset_memory_pressure_bump(void) {}
154 static inline void cpuset_task_status_allowed(struct seq_file *m,
155 struct task_struct *task)
159 static inline void cpuset_lock(void) {}
160 static inline void cpuset_unlock(void) {}
162 static inline int cpuset_mem_spread_node(void)
164 return 0;
167 static inline int cpuset_do_page_mem_spread(void)
169 return 0;
172 static inline int cpuset_do_slab_mem_spread(void)
174 return 0;
177 static inline int current_cpuset_is_being_rebound(void)
179 return 0;
182 static inline void rebuild_sched_domains(void)
184 partition_sched_domains(1, NULL, NULL);
187 static inline void cpuset_print_task_mems_allowed(struct task_struct *p)
191 #endif /* !CONFIG_CPUSETS */
193 #endif /* _LINUX_CPUSET_H */