Commit ba6d1ee6 authored by Andi Kleen's avatar Andi Kleen Committed by Linus Torvalds

[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: default avatarAndi Kleen <ak@suse.de>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent d3eb17fc
......@@ -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) \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment