summaryrefslogtreecommitdiff
path: root/include/linux/nodemask.h
diff options
context:
space:
mode:
authorAndi Kleen <ak@suse.de>2005-01-14 23:24:04 -0800
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-01-14 23:24:04 -0800
commitba6d1ee6b671e2a2fce9604ac87d672cc402e967 (patch)
tree383565576556515dc87cb72c9139f992f42094fd /include/linux/nodemask.h
parentd3eb17fc5430e0321c6f9daa2d0a5e35673454f9 (diff)
[PATCH] x86_64: Optimize nodemask operations slightly
Optimize first/node_node Optimize nodemask_t slightly. The x86-64 find_first/next_bit uses __builtin_constant_p on the size argument to special cases small single long word searches. But most gccs don't make __builtin_constant_p true when an argument is passed through an inline function. Move the constant into the inline function to avoid this. This generates a lot better code for node searches on x86-64. Signed-off-by: Andi Kleen <ak@suse.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include/linux/nodemask.h')
-rw-r--r--include/linux/nodemask.h15
1 files changed, 9 insertions, 6 deletions
diff --git a/include/linux/nodemask.h b/include/linux/nodemask.h
index 16475a23efa7..5f7f8b932cf2 100644
--- a/include/linux/nodemask.h
+++ b/include/linux/nodemask.h
@@ -213,16 +213,19 @@ static inline void __nodes_shift_left(nodemask_t *dstp,
bitmap_shift_left(dstp->bits, srcp->bits, n, nbits);
}
-#define first_node(src) __first_node(&(src), MAX_NUMNODES)
-static inline int __first_node(const nodemask_t *srcp, int nbits)
+/* FIXME: better would be to fix all architectures to never return
+ > MAX_NUMNODES, then the silly min_ts could be dropped. */
+
+#define first_node(src) __first_node(&(src))
+static inline int __first_node(const nodemask_t *srcp)
{
- return min_t(int, nbits, find_first_bit(srcp->bits, nbits));
+ return min_t(int, MAX_NUMNODES, find_first_bit(srcp->bits, MAX_NUMNODES));
}
-#define next_node(n, src) __next_node((n), &(src), MAX_NUMNODES)
-static inline int __next_node(int n, const nodemask_t *srcp, int nbits)
+#define next_node(n, src) __next_node((n), &(src))
+static inline int __next_node(int n, const nodemask_t *srcp)
{
- return min_t(int, nbits, find_next_bit(srcp->bits, nbits, n+1));
+ return min_t(int,MAX_NUMNODES,find_next_bit(srcp->bits, MAX_NUMNODES, n+1));
}
#define nodemask_of_node(node) \