mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: Paul Jackson <pj@sgi.com>
Cc: joe.korty@ccur.com, paulus@samba.org, linux-kernel@vger.kernel.org
Subject: Re: seperator error in __mask_snprintf_len
Date: Thu, 15 Jan 2004 21:26:13 -0800	[thread overview]
Message-ID: <20040115212613.3e345518.akpm@osdl.org> (raw)
In-Reply-To: <20040115211402.04c5c2c4.pj@sgi.com>

Paul Jackson <pj@sgi.com> wrote:
>
>   Should any of the other inline routines in include/bitmap.h
>    be moved to your new file lib/bitmap.c?

Yup.   The below patch will be in 2.6.1-mm4:



uninline bitmap functions

- A couple of them are using alloca (via DECLARE_BITMAP) and this generates
  a cannot-inline warning with -Winline.

- These functions are too big to inline anwyay.



---

 include/linux/bitmap.h |  140 ++++---------------------------------------------
 lib/Makefile           |    3 -
 lib/bitmap.c           |  140 +++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 156 insertions(+), 127 deletions(-)

diff -puN /dev/null lib/bitmap.c
--- /dev/null	2002-08-30 16:31:37.000000000 -0700
+++ 25-akpm/lib/bitmap.c	2004-01-14 02:52:02.000000000 -0800
@@ -0,0 +1,140 @@
+#include <linux/bitmap.h>
+#include <linux/module.h>
+
+int bitmap_empty(const unsigned long *bitmap, int bits)
+{
+	int k, lim = bits/BITS_PER_LONG;
+	for (k = 0; k < lim; ++k)
+		if (bitmap[k])
+			return 0;
+
+	if (bits % BITS_PER_LONG)
+		if (bitmap[k] & ((1UL << (bits % BITS_PER_LONG)) - 1))
+			return 0;
+
+	return 1;
+}
+EXPORT_SYMBOL(bitmap_empty);
+
+int bitmap_full(const unsigned long *bitmap, int bits)
+{
+	int k, lim = bits/BITS_PER_LONG;
+	for (k = 0; k < lim; ++k)
+		if (~bitmap[k])
+			return 0;
+
+	if (bits % BITS_PER_LONG)
+		if (~bitmap[k] & ((1UL << (bits % BITS_PER_LONG)) - 1))
+			return 0;
+
+	return 1;
+}
+EXPORT_SYMBOL(bitmap_full);
+
+int bitmap_equal(const unsigned long *bitmap1,
+		unsigned long *bitmap2, int bits)
+{
+	int k, lim = bits/BITS_PER_LONG;;
+	for (k = 0; k < lim; ++k)
+		if (bitmap1[k] != bitmap2[k])
+			return 0;
+
+	if (bits % BITS_PER_LONG)
+		if ((bitmap1[k] ^ bitmap2[k]) &
+				((1UL << (bits % BITS_PER_LONG)) - 1))
+			return 0;
+
+	return 1;
+}
+EXPORT_SYMBOL(bitmap_equal);
+
+void bitmap_complement(unsigned long *bitmap, int bits)
+{
+	int k;
+
+	for (k = 0; k < BITS_TO_LONGS(bits); ++k)
+		bitmap[k] = ~bitmap[k];
+}
+EXPORT_SYMBOL(bitmap_complement);
+
+void bitmap_shift_right(unsigned long *dst,
+			const unsigned long *src, int shift, int bits)
+{
+	int k;
+	DECLARE_BITMAP(__shr_tmp, bits);
+
+	bitmap_clear(__shr_tmp, bits);
+	for (k = 0; k < bits - shift; ++k)
+		if (test_bit(k + shift, src))
+			set_bit(k, __shr_tmp);
+	bitmap_copy(dst, __shr_tmp, bits);
+}
+EXPORT_SYMBOL(bitmap_shift_right);
+
+void bitmap_shift_left(unsigned long *dst,
+			const unsigned long *src, int shift, int bits)
+{
+	int k;
+	DECLARE_BITMAP(__shl_tmp, bits);
+
+	bitmap_clear(__shl_tmp, bits);
+	for (k = bits; k >= shift; --k)
+		if (test_bit(k - shift, src))
+			set_bit(k, __shl_tmp);
+	bitmap_copy(dst, __shl_tmp, bits);
+}
+EXPORT_SYMBOL(bitmap_shift_left);
+
+void bitmap_and(unsigned long *dst, const unsigned long *bitmap1,
+				const unsigned long *bitmap2, int bits)
+{
+	int k;
+	int nr = BITS_TO_LONGS(bits);
+
+	for (k = 0; k < nr; k++)
+		dst[k] = bitmap1[k] & bitmap2[k];
+}
+EXPORT_SYMBOL(bitmap_and);
+
+void bitmap_or(unsigned long *dst, const unsigned long *bitmap1,
+				const unsigned long *bitmap2, int bits)
+{
+	int k;
+	int nr = BITS_TO_LONGS(bits);
+
+	for (k = 0; k < nr; k++)
+		dst[k] = bitmap1[k] | bitmap2[k];
+}
+EXPORT_SYMBOL(bitmap_or);
+
+#if BITS_PER_LONG == 32
+int bitmap_weight(const unsigned long *bitmap, int bits)
+{
+	int k, w = 0, lim = bits/BITS_PER_LONG;
+
+	for (k = 0; k < lim; k++)
+		w += hweight32(bitmap[k]);
+
+	if (bits % BITS_PER_LONG)
+		w += hweight32(bitmap[k] &
+				((1UL << (bits % BITS_PER_LONG)) - 1));
+
+	return w;
+}
+#else
+int bitmap_weight(const unsigned long *bitmap, int bits)
+{
+	int k, w = 0, lim = bits/BITS_PER_LONG;
+
+	for (k = 0; k < lim; k++)
+		w += hweight64(bitmap[k]);
+
+	if (bits % BITS_PER_LONG)
+		w += hweight64(bitmap[k] &
+				((1UL << (bits % BITS_PER_LONG)) - 1));
+
+	return w;
+}
+#endif
+EXPORT_SYMBOL(bitmap_weight);
+
diff -puN include/linux/bitmap.h~uninline-bitmap-functions include/linux/bitmap.h
--- 25/include/linux/bitmap.h~uninline-bitmap-functions	2004-01-14 02:36:26.000000000 -0800
+++ 25-akpm/include/linux/bitmap.h	2004-01-14 02:36:26.000000000 -0800
@@ -10,57 +10,11 @@
 #include <linux/bitops.h>
 #include <linux/string.h>
 
-static inline int bitmap_empty(const unsigned long *bitmap, int bits)
-{
-	int k, lim = bits/BITS_PER_LONG;
-	for (k = 0; k < lim; ++k)
-		if (bitmap[k])
-			return 0;
-
-	if (bits % BITS_PER_LONG)
-		if (bitmap[k] & ((1UL << (bits % BITS_PER_LONG)) - 1))
-			return 0;
-
-	return 1;
-}
-
-static inline int bitmap_full(const unsigned long *bitmap, int bits)
-{
-	int k, lim = bits/BITS_PER_LONG;
-	for (k = 0; k < lim; ++k)
-		if (~bitmap[k])
-			return 0;
-
-	if (bits % BITS_PER_LONG)
-		if (~bitmap[k] & ((1UL << (bits % BITS_PER_LONG)) - 1))
-			return 0;
-
-	return 1;
-}
-
-static inline int bitmap_equal(const unsigned long *bitmap1,
-				unsigned long *bitmap2, int bits)
-{
-	int k, lim = bits/BITS_PER_LONG;;
-	for (k = 0; k < lim; ++k)
-		if (bitmap1[k] != bitmap2[k])
-			return 0;
-
-	if (bits % BITS_PER_LONG)
-		if ((bitmap1[k] ^ bitmap2[k]) &
-				((1UL << (bits % BITS_PER_LONG)) - 1))
-			return 0;
-
-	return 1;
-}
-
-static inline void bitmap_complement(unsigned long *bitmap, int bits)
-{
-	int k;
-
-	for (k = 0; k < BITS_TO_LONGS(bits); ++k)
-		bitmap[k] = ~bitmap[k];
-}
+int bitmap_empty(const unsigned long *bitmap, int bits);
+int bitmap_full(const unsigned long *bitmap, int bits);
+int bitmap_equal(const unsigned long *bitmap1,
+			unsigned long *bitmap2, int bits);
+void bitmap_complement(unsigned long *bitmap, int bits);
 
 static inline void bitmap_clear(unsigned long *bitmap, int bits)
 {
@@ -78,81 +32,15 @@ static inline void bitmap_copy(unsigned 
 	memcpy(dst, src, BITS_TO_LONGS(bits)*sizeof(unsigned long));
 }
 
-static inline void bitmap_shift_right(unsigned long *dst,
-				const unsigned long *src, int shift, int bits)
-{
-	int k;
-	DECLARE_BITMAP(__shr_tmp, bits);
-
-	bitmap_clear(__shr_tmp, bits);
-	for (k = 0; k < bits - shift; ++k)
-		if (test_bit(k + shift, src))
-			set_bit(k, __shr_tmp);
-	bitmap_copy(dst, __shr_tmp, bits);
-}
-
-static inline void bitmap_shift_left(unsigned long *dst,
-				const unsigned long *src, int shift, int bits)
-{
-	int k;
-	DECLARE_BITMAP(__shl_tmp, bits);
-
-	bitmap_clear(__shl_tmp, bits);
-	for (k = bits; k >= shift; --k)
-		if (test_bit(k - shift, src))
-			set_bit(k, __shl_tmp);
-	bitmap_copy(dst, __shl_tmp, bits);
-}
-
-static inline void bitmap_and(unsigned long *dst, const unsigned long *bitmap1,
-				const unsigned long *bitmap2, int bits)
-{
-	int k;
-	int nr = BITS_TO_LONGS(bits);
-
-	for (k = 0; k < nr; k++)
-		dst[k] = bitmap1[k] & bitmap2[k];
-}
-
-static inline void bitmap_or(unsigned long *dst, const unsigned long *bitmap1,
-				const unsigned long *bitmap2, int bits)
-{
-	int k;
-	int nr = BITS_TO_LONGS(bits);
-
-	for (k = 0; k < nr; k++)
-		dst[k] = bitmap1[k] | bitmap2[k];
-}
-
-#if BITS_PER_LONG == 32
-static inline int bitmap_weight(const unsigned long *bitmap, int bits)
-{
-	int k, w = 0, lim = bits/BITS_PER_LONG;
-
-	for (k = 0; k < lim; k++)
-		w += hweight32(bitmap[k]);
-
-	if (bits % BITS_PER_LONG)
-		w += hweight32(bitmap[k] &
-				((1UL << (bits % BITS_PER_LONG)) - 1));
-
-	return w;
-}
-#else
-static inline int bitmap_weight(const unsigned long *bitmap, int bits)
-{
-	int k, w = 0, lim = bits/BITS_PER_LONG;
-
-	for (k = 0; k < lim; k++)
-		w += hweight64(bitmap[k]);
-
-	if (bits % BITS_PER_LONG)
-		w += hweight64(bitmap[k] &
-				((1UL << (bits % BITS_PER_LONG)) - 1));
-
-	return w;
-}
-#endif
+void bitmap_shift_right(unsigned long *dst,
+			const unsigned long *src, int shift, int bits);
+void bitmap_shift_left(unsigned long *dst,
+			const unsigned long *src, int shift, int bits);
+void bitmap_and(unsigned long *dst, const unsigned long *bitmap1,
+			const unsigned long *bitmap2, int bits);
+void bitmap_or(unsigned long *dst, const unsigned long *bitmap1,
+			const unsigned long *bitmap2, int bits);
+int bitmap_weight(const unsigned long *bitmap, int bits);
 
 #endif /* __ASSEMBLY__ */
 
diff -puN lib/Makefile~uninline-bitmap-functions lib/Makefile
--- 25/lib/Makefile~uninline-bitmap-functions	2004-01-14 02:36:26.000000000 -0800
+++ 25-akpm/lib/Makefile	2004-01-14 02:36:26.000000000 -0800
@@ -5,7 +5,8 @@
 
 lib-y := errno.o ctype.o string.o vsprintf.o cmdline.o \
 	 bust_spinlocks.o rbtree.o radix-tree.o dump_stack.o \
-	 kobject.o idr.o div64.o parser.o int_sqrt.o mask.o
+	 kobject.o idr.o div64.o parser.o int_sqrt.o mask.o \
+	 bitmap.o
 
 lib-$(CONFIG_RWSEM_GENERIC_SPINLOCK) += rwsem-spinlock.o
 lib-$(CONFIG_RWSEM_XCHGADD_ALGORITHM) += rwsem.o

_


  reply	other threads:[~2004-01-16  5:27 UTC|newest]

Thread overview: 59+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-07 16:56 Joe Korty
2004-01-07 19:32 ` Andrew Morton
2004-01-08 13:11   ` Paul Jackson
2004-01-08 22:50     ` Paul Mackerras
2004-01-08 22:59       ` Joe Korty
2004-01-09  0:07         ` Paul Mackerras
2004-01-09  1:11           ` Paul Jackson
2004-01-14 23:03           ` Paul Jackson
2004-01-15  0:27             ` Joe Korty
2004-01-15  0:37               ` Paul Jackson
2004-01-15  4:40               ` Paul Jackson
2004-01-15 16:15                 ` Andrew Morton
2004-01-15 18:15                   ` Joe Korty
2004-01-16  0:17                     ` Paul Jackson
2004-01-16  0:48                       ` Joe Korty
2004-01-16  1:48                         ` Paul Jackson
2004-01-16 23:29                       ` Matthew Dobson
2004-01-17  6:36                         ` [PATCH] bitmap parsing routines, version 3 Joe Korty
2004-01-17 10:08                           ` Paul Jackson
     [not found]                             ` <20040117145545.GA16318@tsunami.ccur.com>
2004-01-17 15:36                               ` Joe Korty
2004-01-17 23:33                                 ` Paul Jackson
2004-01-18  5:52                                   ` William Lee Irwin III
2004-01-18  7:03                                     ` Paul Jackson
2004-01-17 18:39                           ` [PATCH] bitmap parsing/printing routines, version 4 Joe Korty
2004-01-17 23:36                             ` Paul Jackson
2004-01-19 21:17                             ` Matthew Dobson
2004-01-20  0:17                               ` Paul Jackson
2004-01-20  3:57                               ` Joe Korty
2004-01-20  4:15                                 ` Paul Jackson
2004-01-20  5:41                                 ` Randy Dunlap
2004-01-20  7:03                                 ` Matthew Dobson
2004-01-20 15:36                                   ` Joe Korty
2004-01-20 17:06                                     ` Matthew Dobson
2004-01-17  9:12                         ` seperator error in __mask_snprintf_len Paul Jackson
2004-01-16  5:14                     ` Paul Jackson
2004-01-16  5:26                       ` Andrew Morton [this message]
2004-01-16  5:52                         ` William Lee Irwin III
2004-01-16 14:23                       ` Joe Korty
2004-01-17 10:07                         ` Paul Jackson
2004-01-15 22:53                   ` Paul Jackson
2004-01-16  1:06                     ` Andrew Morton
2004-01-16  2:54                       ` Paul Jackson
2004-01-09 14:28         ` Paul Jackson
2004-01-09 14:46       ` Paul Jackson
2004-01-09 15:14         ` Andreas Schwab
2004-01-09 15:25           ` Christoph Hellwig
2004-01-09 17:23             ` Paul Jackson
2004-01-12  0:09               ` Joe Korty
2004-01-12 21:41                 ` Paul Jackson
2004-01-12 22:00                   ` Joe Korty
2004-01-12 22:28                     ` Paul Jackson
2004-01-12 22:39                       ` Joe Korty
2004-01-09 14:57       ` Paul Jackson
2004-01-08  1:06 ` Paul Jackson
2004-01-08  3:32   ` Joe Korty
2004-01-08 10:39     ` Paul Jackson
     [not found] <1bpdu-5jP-35@gated-at.bofh.it>
     [not found] ` <1brIi-Y0-57@gated-at.bofh.it>
     [not found]   ` <1bIf6-fh-21@gated-at.bofh.it>
     [not found]     ` <1bRiA-4PD-19@gated-at.bofh.it>
     [not found]       ` <1bRrZ-58C-9@gated-at.bofh.it>
     [not found]         ` <1bSHD-Xz-21@gated-at.bofh.it>
     [not found]           ` <1e2sZ-rG-19@gated-at.bofh.it>
     [not found]             ` <1e3Ih-1V0-1@gated-at.bofh.it>
     [not found]               ` <1e7Cd-4qD-5@gated-at.bofh.it>
     [not found]                 ` <1einZ-64E-11@gated-at.bofh.it>
     [not found]                   ` <1ekpM-87C-1@gated-at.bofh.it>
     [not found]                     ` <1euyS-Eb-19@gated-at.bofh.it>
     [not found]                       ` <1euSb-U8-3@gated-at.bofh.it>
2004-01-16  8:25                         ` Andi Kleen
2004-01-16  8:35                           ` Andrew Morton
2004-01-16 10:16                             ` Andi Kleen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040115212613.3e345518.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=joe.korty@ccur.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paulus@samba.org \
    --cc=pj@sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome