aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/bitmap.h
diff options
context:
space:
mode:
authorPaul Jackson <pj@sgi.com>2005-10-30 18:02:33 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2005-10-30 20:37:21 -0500
commitfb5eeeee44edb248b4837416966f19731f497f79 (patch)
treef947a4dcf103f55d526bb5c71f69b657d8f22e61 /include/linux/bitmap.h
parent28a42b9ea7e42e1efb02cc2dcacba0b6af234e1b (diff)
[PATCH] cpusets: bitmap and mask remap operators
In the forthcoming task migration support, a key calculation will be mapping cpu and node numbers from the old set to the new set while preserving cpuset-relative offset. For example, if a task and its pages on nodes 8-11 are being migrated to nodes 24-27, then pages on node 9 (the 2nd node in the old set) should be moved to node 25 (the 2nd node in the new set.) As with other bitmap operations, the proper way to code this is to provide the underlying calculation in lib/bitmap.c, and then to provide the usual cpumask and nodemask wrappers. This patch provides that. These operations are termed 'remap' operations. Both remapping a single bit and a set of bits is supported. 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/bitmap.h')
-rw-r--r--include/linux/bitmap.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/linux/bitmap.h b/include/linux/bitmap.h
index 86dd5502b05c..7d8ff97b3e92 100644
--- a/include/linux/bitmap.h
+++ b/include/linux/bitmap.h
@@ -40,6 +40,8 @@
40 * bitmap_weight(src, nbits) Hamming Weight: number set bits 40 * bitmap_weight(src, nbits) Hamming Weight: number set bits
41 * bitmap_shift_right(dst, src, n, nbits) *dst = *src >> n 41 * bitmap_shift_right(dst, src, n, nbits) *dst = *src >> n
42 * bitmap_shift_left(dst, src, n, nbits) *dst = *src << n 42 * bitmap_shift_left(dst, src, n, nbits) *dst = *src << n
43 * bitmap_remap(dst, src, old, new, nbits) *dst = map(old, new)(src)
44 * bitmap_bitremap(oldbit, old, new, nbits) newbit = map(old, new)(oldbit)
43 * bitmap_scnprintf(buf, len, src, nbits) Print bitmap src to buf 45 * bitmap_scnprintf(buf, len, src, nbits) Print bitmap src to buf
44 * bitmap_parse(ubuf, ulen, dst, nbits) Parse bitmap dst from user buf 46 * bitmap_parse(ubuf, ulen, dst, nbits) Parse bitmap dst from user buf
45 * bitmap_scnlistprintf(buf, len, src, nbits) Print bitmap src as list to buf 47 * bitmap_scnlistprintf(buf, len, src, nbits) Print bitmap src as list to buf
@@ -104,6 +106,10 @@ extern int bitmap_scnlistprintf(char *buf, unsigned int len,
104 const unsigned long *src, int nbits); 106 const unsigned long *src, int nbits);
105extern int bitmap_parselist(const char *buf, unsigned long *maskp, 107extern int bitmap_parselist(const char *buf, unsigned long *maskp,
106 int nmaskbits); 108 int nmaskbits);
109extern void bitmap_remap(unsigned long *dst, const unsigned long *src,
110 const unsigned long *old, const unsigned long *new, int bits);
111extern int bitmap_bitremap(int oldbit,
112 const unsigned long *old, const unsigned long *new, int bits);
107extern int bitmap_find_free_region(unsigned long *bitmap, int bits, int order); 113extern int bitmap_find_free_region(unsigned long *bitmap, int bits, int order);
108extern void bitmap_release_region(unsigned long *bitmap, int pos, int order); 114extern void bitmap_release_region(unsigned long *bitmap, int pos, int order);
109extern int bitmap_allocate_region(unsigned long *bitmap, int pos, int order); 115extern int bitmap_allocate_region(unsigned long *bitmap, int pos, int order);