Skip to content

Commit

Permalink
[PATCH] cpumask: uninline first_cpu()
Browse files Browse the repository at this point in the history
           text    data     bss     dec     hex filename
before: 3490577 1322408  360000 5172985  4eeef9 vmlinux
after:  3488027 1322496  360128 5170651  4ee5db vmlinux

Cc: Paul Jackson <pj@sgi.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
Andrew Morton authored and Linus Torvalds committed Mar 25, 2006
1 parent 64b9137 commit ccb4600
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
11 changes: 6 additions & 5 deletions include/linux/cpumask.h
Original file line number Diff line number Diff line change
Expand Up @@ -212,11 +212,12 @@ static inline void __cpus_shift_left(cpumask_t *dstp,
bitmap_shift_left(dstp->bits, srcp->bits, n, nbits);
}

#define first_cpu(src) __first_cpu(&(src), NR_CPUS)
static inline int __first_cpu(const cpumask_t *srcp, int nbits)
{
return min_t(int, nbits, find_first_bit(srcp->bits, nbits));
}
#ifdef CONFIG_SMP
int __first_cpu(const cpumask_t *srcp);
#define first_cpu(src) __first_cpu(&(src))
#else
#define first_cpu(src) 0
#endif

#define next_cpu(n, src) __next_cpu((n), &(src), NR_CPUS)
static inline int __next_cpu(int n, const cpumask_t *srcp, int nbits)
Expand Down
2 changes: 2 additions & 0 deletions lib/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ lib-y := errno.o ctype.o string.o vsprintf.o cmdline.o \
idr.o div64.o int_sqrt.o bitmap.o extable.o prio_tree.o \
sha1.o

lib-$(CONFIG_SMP) += cpumask.o

lib-y += kobject.o kref.o kobject_uevent.o klist.o

obj-y += sort.o parser.o halfmd4.o iomap_copy.o
Expand Down
11 changes: 11 additions & 0 deletions lib/cpumask.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#include <linux/kernel.h>
#include <linux/bitops.h>
#include <linux/cpumask.h>
#include <linux/module.h>

int __first_cpu(const cpumask_t *srcp)
{
return min_t(int, NR_CPUS, find_first_bit(srcp->bits, NR_CPUS));
}
EXPORT_SYMBOL(__first_cpu);

0 comments on commit ccb4600

Please sign in to comment.