diff options
author | Paul Jackson <pj@sgi.com> | 2006-01-08 12:01:57 +0300 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-09 07:13:44 +0300 |
commit | 202f72d5d1b5c2c084f63ef996c736d208b447b5 (patch) | |
tree | f50551f9588f9090fee17130614e17a2dd64c656 /include/linux/cpuset.h | |
parent | 74cb21553f4bf244185b9bec4c26e4e3169ad55e (diff) | |
download | linux-202f72d5d1b5c2c084f63ef996c736d208b447b5.tar.xz |
[PATCH] cpuset: number_of_cpusets optimization
Easy little optimization hack to avoid actually having to call
cpuset_zone_allowed() and check mems_allowed, in the main page allocation
routine, __alloc_pages(). This saves several CPU cycles per page allocation
on systems not using cpusets.
A counter is updated each time a cpuset is created or removed, and whenever
there is only one cpuset in the system, it must be the root cpuset, which
contains all CPUs and all Memory Nodes. In that case, when the counter is
one, all allocations are allowed.
Signed-off-by: Paul Jackson <pj@sgi.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include/linux/cpuset.h')
-rw-r--r-- | include/linux/cpuset.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h index 37d2dd7ca3e9..34081c168af5 100644 --- a/include/linux/cpuset.h +++ b/include/linux/cpuset.h @@ -14,6 +14,8 @@ #ifdef CONFIG_CPUSETS +extern int number_of_cpusets; /* How many cpusets are defined in system? */ + extern int cpuset_init(void); extern void cpuset_init_smp(void); extern void cpuset_fork(struct task_struct *p); @@ -25,7 +27,13 @@ void cpuset_update_task_memory_state(void); #define cpuset_nodes_subset_current_mems_allowed(nodes) \ nodes_subset((nodes), current->mems_allowed) int cpuset_zonelist_valid_mems_allowed(struct zonelist *zl); -extern int cpuset_zone_allowed(struct zone *z, gfp_t gfp_mask); + +extern int __cpuset_zone_allowed(struct zone *z, gfp_t gfp_mask); +static int inline cpuset_zone_allowed(struct zone *z, gfp_t gfp_mask) +{ + return number_of_cpusets <= 1 || __cpuset_zone_allowed(z, gfp_mask); +} + extern int cpuset_excl_nodes_overlap(const struct task_struct *p); #define cpuset_memory_pressure_bump() \ |