public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] remove all kernel bugs
@ 2005-04-01  9:07 Matt Mackall
  2005-04-01  9:17 ` Jan-Benedict Glaw
  2005-04-01  9:34 ` Andrew Morton
  0 siblings, 2 replies; 6+ messages in thread
From: Matt Mackall @ 2005-04-01  9:07 UTC (permalink / raw)
  To: Andrew Morton, Linus Torvalds, linux-kernel

I've been sitting on this patch for a while, figured it's high time I
shared it with the world. This patch eliminates all kernel bugs, trims
about 35k off the typical kernel, and makes the system slightly
faster. The patch is against the latest bk snapshot, please apply.

Signed-off-by: Matt Mackall <mpm@selenic.com>

Index: af/include/asm-i386/bug.h
===================================================================
--- af.orig/include/asm-i386/bug.h	2005-03-02 22:51:03.000000000 -0800
+++ af/include/asm-i386/bug.h	2005-04-01 00:33:32.000000000 -0800
@@ -9,6 +9,8 @@
  * undefined" opcode for parsing in the trap handler.
  */
 
+#ifdef CONFIG_BUG
+#define HAVE_ARCH_BUG
 #ifdef CONFIG_DEBUG_BUGVERBOSE
 #define BUG()				\
  __asm__ __volatile__(	"ud2\n"		\
@@ -18,8 +20,7 @@
 #else
 #define BUG() __asm__ __volatile__("ud2\n")
 #endif
+#endif
 
-#define HAVE_ARCH_BUG
 #include <asm-generic/bug.h>
-
 #endif
Index: af/include/asm-x86_64/bug.h
===================================================================
--- af.orig/include/asm-x86_64/bug.h	2005-03-02 22:51:03.000000000 -0800
+++ af/include/asm-x86_64/bug.h	2005-04-01 00:33:32.000000000 -0800
@@ -15,11 +15,14 @@ struct bug_frame {
 	unsigned short line;
 } __attribute__((packed));
 
+#ifdef CONFIG_BUG
 #define HAVE_ARCH_BUG
 #define BUG() \
 	asm volatile("ud2 ; .quad %c1 ; .short %c0" :: \
 		     "i"(__LINE__), "i" (__stringify(KBUILD_BASENAME)))
 void out_of_line_bug(void);
+#endif
+
 #include <asm-generic/bug.h>
 
 #endif
Index: af/include/asm-sparc64/bug.h
===================================================================
--- af.orig/include/asm-sparc64/bug.h	2005-03-02 22:51:03.000000000 -0800
+++ af/include/asm-sparc64/bug.h	2005-04-01 00:33:32.000000000 -0800
@@ -1,6 +1,7 @@
 #ifndef _SPARC64_BUG_H
 #define _SPARC64_BUG_H
 
+#ifdef CONFIG_BUG
 #include <linux/compiler.h>
 
 #ifdef CONFIG_DEBUG_BUGVERBOSE
@@ -14,6 +15,8 @@ extern void do_BUG(const char *file, int
 #endif
 
 #define HAVE_ARCH_BUG
+#endif
+
 #include <asm-generic/bug.h>
 
 #endif
Index: af/include/asm-m68k/bug.h
===================================================================
--- af.orig/include/asm-m68k/bug.h	2005-03-02 22:51:03.000000000 -0800
+++ af/include/asm-m68k/bug.h	2005-04-01 00:33:32.000000000 -0800
@@ -3,6 +3,7 @@
 
 #include <linux/config.h>
 
+#ifdef CONFIG_BUG
 #ifdef CONFIG_DEBUG_BUGVERBOSE
 #ifndef CONFIG_SUN3
 #define BUG() do { \
@@ -22,6 +23,8 @@
 #endif
 
 #define HAVE_ARCH_BUG
+#endif
+
 #include <asm-generic/bug.h>
 
 #endif
Index: af/include/asm-generic/bug.h
===================================================================
--- af.orig/include/asm-generic/bug.h	2005-03-02 22:51:03.000000000 -0800
+++ af/include/asm-generic/bug.h	2005-04-01 00:33:32.000000000 -0800
@@ -4,6 +4,7 @@
 #include <linux/compiler.h>
 #include <linux/config.h>
 
+#ifdef CONFIG_BUG
 #ifndef HAVE_ARCH_BUG
 #define BUG() do { \
 	printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \
@@ -31,4 +32,22 @@
 } while (0)
 #endif
 
+#else /* !CONFIG_BUG */
+#ifndef HAVE_ARCH_BUG
+#define BUG()
+#endif
+
+#ifndef HAVE_ARCH_PAGE_BUG
+#define PAGE_BUG(page) do { if (page) ; } while (0)
+#endif
+
+#ifndef HAVE_ARCH_BUG_ON
+#define BUG_ON(condition) do { if (condition) ; } while(0)
+#endif
+
+#ifndef HAVE_ARCH_WARN_ON
+#define WARN_ON(condition) do { if (condition) ; } while(0)
+#endif
+#endif
+
 #endif
Index: af/include/asm-s390/bug.h
===================================================================
--- af.orig/include/asm-s390/bug.h	2005-03-02 22:51:03.000000000 -0800
+++ af/include/asm-s390/bug.h	2005-04-01 00:33:32.000000000 -0800
@@ -3,12 +3,15 @@
 
 #include <linux/kernel.h>
 
+#ifdef CONFIG_BUG
 #define BUG() do { \
         printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \
         __asm__ __volatile__(".long 0"); \
 } while (0)
 
 #define HAVE_ARCH_BUG
+#endif
+
 #include <asm-generic/bug.h>
 
 #endif
Index: af/include/asm-arm/bug.h
===================================================================
--- af.orig/include/asm-arm/bug.h	2005-03-02 22:51:03.000000000 -0800
+++ af/include/asm-arm/bug.h	2005-04-01 00:33:32.000000000 -0800
@@ -3,6 +3,7 @@
 
 #include <linux/config.h>
 
+#ifdef CONFIG_BUG
 #ifdef CONFIG_DEBUG_BUGVERBOSE
 extern volatile void __bug(const char *file, int line, void *data);
 
@@ -17,6 +18,8 @@ extern volatile void __bug(const char *f
 #endif
 
 #define HAVE_ARCH_BUG
+#endif
+
 #include <asm-generic/bug.h>
 
 #endif
Index: af/include/asm-arm26/bug.h
===================================================================
--- af.orig/include/asm-arm26/bug.h	2005-03-02 22:51:03.000000000 -0800
+++ af/include/asm-arm26/bug.h	2005-04-01 00:33:32.000000000 -0800
@@ -3,6 +3,7 @@
 
 #include <linux/config.h>
 
+#ifdef CONFIG_BUG
 #ifdef CONFIG_DEBUG_BUGVERBOSE
 extern volatile void __bug(const char *file, int line, void *data);
 /* give file/line information */
@@ -12,6 +13,8 @@ extern volatile void __bug(const char *f
 #endif
 
 #define HAVE_ARCH_BUG
+#endif
+
 #include <asm-generic/bug.h>
 
 #endif
Index: af/include/asm-ia64/bug.h
===================================================================
--- af.orig/include/asm-ia64/bug.h	2005-03-02 22:51:03.000000000 -0800
+++ af/include/asm-ia64/bug.h	2005-04-01 00:33:32.000000000 -0800
@@ -1,6 +1,7 @@
 #ifndef _ASM_IA64_BUG_H
 #define _ASM_IA64_BUG_H
 
+#ifdef CONFIG_BUG
 #if (__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)
 # define ia64_abort()	__builtin_trap()
 #else
@@ -8,8 +9,10 @@
 #endif
 #define BUG() do { printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); ia64_abort(); } while (0)
 
-/* should this BUG should be made generic? */
+/* should this BUG be made generic? */
 #define HAVE_ARCH_BUG
+#endif
+
 #include <asm-generic/bug.h>
 
 #endif
Index: af/include/asm-v850/bug.h
===================================================================
--- af.orig/include/asm-v850/bug.h	2005-03-02 22:51:03.000000000 -0800
+++ af/include/asm-v850/bug.h	2005-04-01 00:33:32.000000000 -0800
@@ -14,9 +14,12 @@
 #ifndef __V850_BUG_H__
 #define __V850_BUG_H__
 
+#ifdef CONFIG_BUG
 extern void __bug (void) __attribute__ ((noreturn));
 #define BUG()		__bug()
 #define HAVE_ARCH_BUG
+#endif
+
 #include <asm-generic/bug.h>
 
 #endif /* __V850_BUG_H__ */
Index: af/include/asm-alpha/bug.h
===================================================================
--- af.orig/include/asm-alpha/bug.h	2005-03-02 22:51:03.000000000 -0800
+++ af/include/asm-alpha/bug.h	2005-04-01 00:33:32.000000000 -0800
@@ -1,6 +1,7 @@
 #ifndef _ALPHA_BUG_H
 #define _ALPHA_BUG_H
 
+#ifdef CONFIG_BUG
 #include <asm/pal.h>
 
 /* ??? Would be nice to use .gprel32 here, but we can't be sure that the
@@ -10,6 +11,8 @@
 		       : : "i" (PAL_bugchk), "i"(__LINE__), "i"(__FILE__))
 
 #define HAVE_ARCH_BUG
+#endif
+
 #include <asm-generic/bug.h>
 
 #endif
Index: af/include/asm-ppc/bug.h
===================================================================
--- af.orig/include/asm-ppc/bug.h	2005-03-02 22:51:03.000000000 -0800
+++ af/include/asm-ppc/bug.h	2005-04-01 00:33:32.000000000 -0800
@@ -14,6 +14,7 @@ struct bug_entry {
  */
 #define BUG_WARNING_TRAP	0x1000000
 
+#ifdef CONFIG_BUG
 #define BUG() do {							 \
 	__asm__ __volatile__(						 \
 		"1:	twi 31,0,0\n"					 \
@@ -50,6 +51,8 @@ struct bug_entry {
 #define HAVE_ARCH_BUG
 #define HAVE_ARCH_BUG_ON
 #define HAVE_ARCH_WARN_ON
+#endif
+
 #include <asm-generic/bug.h>
 
 #endif
Index: af/include/asm-frv/bug.h
===================================================================
--- af.orig/include/asm-frv/bug.h	2005-03-02 22:51:03.000000000 -0800
+++ af/include/asm-frv/bug.h	2005-04-01 00:33:32.000000000 -0800
@@ -13,6 +13,7 @@
 
 #include <linux/config.h>
 
+#ifdef CONFIG_BUG
 /*
  * Tell the user there is some problem.
  */
@@ -45,6 +46,7 @@ do {						\
 #define HAVE_ARCH_KGDB_BAD_PAGE
 #define kgdb_bad_page(page) do { kgdb_raise(SIGABRT); } while(0)
 #endif
+#endif
 
 #include <asm-generic/bug.h>
 
Index: af/include/asm-ppc64/bug.h
===================================================================
--- af.orig/include/asm-ppc64/bug.h	2005-03-02 22:51:03.000000000 -0800
+++ af/include/asm-ppc64/bug.h	2005-04-01 00:33:32.000000000 -0800
@@ -26,6 +26,8 @@ struct bug_entry *find_bug(unsigned long
  */
 #define BUG_WARNING_TRAP	0x1000000
 
+#ifdef CONFIG_BUG
+
 #define BUG() do {							 \
 	__asm__ __volatile__(						 \
 		"1:	twi 31,0,0\n"					 \
@@ -55,11 +57,12 @@ struct bug_entry *find_bug(unsigned long
 		    "i" (__FILE__), "i" (__FUNCTION__));	\
 } while (0)
 
-#endif
-
 #define HAVE_ARCH_BUG
 #define HAVE_ARCH_BUG_ON
 #define HAVE_ARCH_WARN_ON
+#endif
+#endif
+
 #include <asm-generic/bug.h>
 
 #endif
Index: af/include/asm-sh/bug.h
===================================================================
--- af.orig/include/asm-sh/bug.h	2005-04-01 00:31:54.000000000 -0800
+++ af/include/asm-sh/bug.h	2005-04-01 00:33:32.000000000 -0800
@@ -3,6 +3,7 @@
 
 #include <linux/config.h>
 
+#ifdef CONFIG_BUG
 /*
  * Tell the user there is some problem.
  */
@@ -12,6 +13,8 @@
 } while (0)
 
 #define HAVE_ARCH_BUG
+#endif
+
 #include <asm-generic/bug.h>
 
 #endif
Index: af/include/asm-sparc/bug.h
===================================================================
--- af.orig/include/asm-sparc/bug.h	2005-03-02 22:51:03.000000000 -0800
+++ af/include/asm-sparc/bug.h	2005-04-01 00:33:32.000000000 -0800
@@ -1,6 +1,7 @@
 #ifndef _SPARC_BUG_H
 #define _SPARC_BUG_H
 
+#ifdef CONFIG_BUG
 /* Only use the inline asm until a gcc release that can handle __builtin_trap
  * -rob 2003-06-25
  *
@@ -26,6 +27,8 @@ extern void do_BUG(const char *file, int
 #endif
 
 #define HAVE_ARCH_BUG
+#endif
+
 #include <asm-generic/bug.h>
 
 #endif
Index: af/include/asm-mips/bug.h
===================================================================
--- af.orig/include/asm-mips/bug.h	2005-03-02 22:51:03.000000000 -0800
+++ af/include/asm-mips/bug.h	2005-04-01 00:33:32.000000000 -0800
@@ -3,12 +3,14 @@
 
 #include <asm/break.h>
 
+#ifdef CONFIG_BUG
+#define HAVE_ARCH_BUG
 #define BUG()								\
 do {									\
 	__asm__ __volatile__("break %0" : : "i" (BRK_BUG));		\
 } while (0)
+#endif
 
-#define HAVE_ARCH_BUG
 #include <asm-generic/bug.h>
 
 #endif
Index: af/include/asm-parisc/bug.h
===================================================================
--- af.orig/include/asm-parisc/bug.h	2005-03-02 22:51:03.000000000 -0800
+++ af/include/asm-parisc/bug.h	2005-04-01 00:33:32.000000000 -0800
@@ -1,12 +1,14 @@
 #ifndef _PARISC_BUG_H
 #define _PARISC_BUG_H
 
+#ifdef CONFIG_BUG
 #define HAVE_ARCH_BUG
 #define BUG() do { \
 	printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \
 	dump_stack(); \
 	panic("BUG!"); \
 } while (0)
+#endif
 
 #include <asm-generic/bug.h>
 #endif
Index: af/lib/Kconfig.debug
===================================================================
--- af.orig/lib/Kconfig.debug	2005-04-01 00:32:18.000000000 -0800
+++ af/lib/Kconfig.debug	2005-04-01 00:41:02.000000000 -0800
@@ -108,6 +108,7 @@ config DEBUG_HIGHMEM
 
 config DEBUG_BUGVERBOSE
 	bool "Verbose BUG() reporting (adds 70K)" if DEBUG_KERNEL && EMBEDDED
+	depends on BUG
 	depends on ARM || ARM26 || M32R || M68K || SPARC32 || SPARC64 || (X86 && !X86_64) || FRV
 	default !EMBEDDED
 	help
Index: af/init/Kconfig
===================================================================
--- af.orig/init/Kconfig	2005-04-01 00:32:18.000000000 -0800
+++ af/init/Kconfig	2005-04-01 00:40:27.000000000 -0800
@@ -275,6 +275,16 @@ config KALLSYMS_EXTRA_PASS
 	   reported.  KALLSYMS_EXTRA_PASS is only a temporary workaround while
 	   you wait for kallsyms to be fixed.
 
+config BUG
+	bool "BUG() support" if EMBEDDED
+	default y
+	help
+          Disabling this option eliminates support for BUG and WARN, reducing
+          the size of your kernel image and potentially quietly ignoring
+          numerous fatal conditions. You should only consider disabling this
+          option for embedded systems with no facilities for reporting errors.
+          Just say Y.
+
 config BASE_FULL
 	default y
 	bool "Enable full-sized data structures for core" if EMBEDDED


-- 
Mathematics is the supreme nostalgia of our time.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] remove all kernel bugs
  2005-04-01  9:07 [PATCH] remove all kernel bugs Matt Mackall
@ 2005-04-01  9:17 ` Jan-Benedict Glaw
  2005-04-02 21:03   ` Geert Uytterhoeven
  2005-04-01  9:34 ` Andrew Morton
  1 sibling, 1 reply; 6+ messages in thread
From: Jan-Benedict Glaw @ 2005-04-01  9:17 UTC (permalink / raw)
  To: Matt Mackall; +Cc: Andrew Morton, Linus Torvalds, linux-kernel

On Fri, 2005-04-01 01:07:44 -0800, Matt Mackall <mpm@selenic.com>
wrote in message <20050401090744.GD15453@waste.org>:
> I've been sitting on this patch for a while, figured it's high time I
> shared it with the world. This patch eliminates all kernel bugs, trims
> about 35k off the typical kernel, and makes the system slightly
> faster. The patch is against the latest bk snapshot, please apply.
> 
> Signed-off-by: Matt Mackall <mpm@selenic.com>

Well, the patch looks fine, but you forgot to also do the VAX-specific
part. Withoug the BUGs, maybe the VAX kernel would be even faster?

:-), JBG

-- 
Jan-Benedict Glaw       jbglaw@lug-owl.de    . +49-172-7608481             _ O _
"Eine Freie Meinung in  einem Freien Kopf    | Gegen Zensur | Gegen Krieg  _ _ O
 fuer einen Freien Staat voll Freier Bürger" | im Internet! |   im Irak!   O O O
ret = do_actions((curr | FREE_SPEECH) & ~(NEW_COPYRIGHT_LAW | DRM | TCPA));

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] remove all kernel bugs
  2005-04-01  9:07 [PATCH] remove all kernel bugs Matt Mackall
  2005-04-01  9:17 ` Jan-Benedict Glaw
@ 2005-04-01  9:34 ` Andrew Morton
  2005-04-01 20:06   ` Matt Mackall
  1 sibling, 1 reply; 6+ messages in thread
From: Andrew Morton @ 2005-04-01  9:34 UTC (permalink / raw)
  To: Matt Mackall; +Cc: torvalds, linux-kernel

Matt Mackall <mpm@selenic.com> wrote:
>
> I've been sitting on this patch for a while, figured it's high time I
>  shared it with the world. This patch eliminates all kernel bugs, trims
>  about 35k off the typical kernel, and makes the system slightly
>  faster. The patch is against the latest bk snapshot, please apply.

ho-hum, more ifdefs.

How's about you nuke PAGE_BUG first?  Just replace it with BUG() everywhere.

Or do it as a later patch - doesn't matter much I guess.

Or tell me to naff off and don't do it at all ;)

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] remove all kernel bugs
  2005-04-01  9:34 ` Andrew Morton
@ 2005-04-01 20:06   ` Matt Mackall
  0 siblings, 0 replies; 6+ messages in thread
From: Matt Mackall @ 2005-04-01 20:06 UTC (permalink / raw)
  To: Andrew Morton; +Cc: torvalds, linux-kernel

On Fri, Apr 01, 2005 at 01:34:54AM -0800, Andrew Morton wrote:
> Matt Mackall <mpm@selenic.com> wrote:
> >
> > I've been sitting on this patch for a while, figured it's high time I
> >  shared it with the world. This patch eliminates all kernel bugs, trims
> >  about 35k off the typical kernel, and makes the system slightly
> >  faster. The patch is against the latest bk snapshot, please apply.
> 
> ho-hum, more ifdefs.
> 
> How's about you nuke PAGE_BUG first?  Just replace it with BUG() everywhere.
> 
> Or do it as a later patch - doesn't matter much I guess.

With pleasure.

Exterminate PAGE_BUG.

Signed-off-by: Matt Mackall <mpm@selenic.com>

Index: af/include/asm-sh64/bug.h
===================================================================
--- af.orig/include/asm-sh64/bug.h	2005-04-01 11:17:38.000000000 -0800
+++ af/include/asm-sh64/bug.h	2005-04-01 11:17:40.000000000 -0800
@@ -17,10 +17,6 @@
 		BUG(); \
 } while(0)
 
-#define PAGE_BUG(page) do { \
-	BUG(); \
-} while (0)
-
 #define WARN_ON(condition) do { \
 	if (unlikely((condition)!=0)) { \
 		printk("Badness in %s at %s:%d\n", __FUNCTION__, __FILE__, __LINE__); \
Index: af/fs/buffer.c
===================================================================
--- af.orig/fs/buffer.c	2005-04-01 11:17:38.000000000 -0800
+++ af/fs/buffer.c	2005-04-01 11:17:40.000000000 -0800
@@ -2078,8 +2078,7 @@ int block_read_full_page(struct page *pa
 	int nr, i;
 	int fully_mapped = 1;
 
-	if (!PageLocked(page))
-		PAGE_BUG(page);
+	BUG_ON(!PageLocked(page));
 	blocksize = 1 << inode->i_blkbits;
 	if (!page_has_buffers(page))
 		create_empty_buffers(page, blocksize, 0);
Index: af/fs/afs/file.c
===================================================================
--- af.orig/fs/afs/file.c	2005-04-01 11:17:38.000000000 -0800
+++ af/fs/afs/file.c	2005-04-01 11:17:40.000000000 -0800
@@ -131,8 +131,7 @@ static int afs_file_readpage(struct file
 
 	vnode = AFS_FS_I(inode);
 
-	if (!PageLocked(page))
-		PAGE_BUG(page);
+	BUG_ON(!PageLocked(page));
 
 	ret = -ESTALE;
 	if (vnode->flags & AFS_VNODE_DELETED)
Index: af/include/asm-generic/bug.h
===================================================================
--- af.orig/include/asm-generic/bug.h	2005-04-01 11:17:38.000000000 -0800
+++ af/include/asm-generic/bug.h	2005-04-01 11:17:40.000000000 -0800
@@ -12,13 +12,6 @@
 } while (0)
 #endif
 
-#ifndef HAVE_ARCH_PAGE_BUG
-#define PAGE_BUG(page) do { \
-	printk("page BUG for page at %p\n", page); \
-	BUG(); \
-} while (0)
-#endif
-
 #ifndef HAVE_ARCH_BUG_ON
 #define BUG_ON(condition) do { if (unlikely((condition)!=0)) BUG(); } while(0)
 #endif
@@ -37,10 +30,6 @@
 #define BUG()
 #endif
 
-#ifndef HAVE_ARCH_PAGE_BUG
-#define PAGE_BUG(page) do { if (page) ; } while (0)
-#endif
-
 #ifndef HAVE_ARCH_BUG_ON
 #define BUG_ON(condition) do { if (condition) ; } while(0)
 #endif
Index: af/fs/jffs2/file.c
===================================================================
--- af.orig/fs/jffs2/file.c	2005-04-01 11:17:38.000000000 -0800
+++ af/fs/jffs2/file.c	2005-04-01 11:17:40.000000000 -0800
@@ -79,8 +79,7 @@ static int jffs2_do_readpage_nolock (str
 
 	D2(printk(KERN_DEBUG "jffs2_do_readpage_nolock(): ino #%lu, page at offset 0x%lx\n", inode->i_ino, pg->index << PAGE_CACHE_SHIFT));
 
-	if (!PageLocked(pg))
-                PAGE_BUG(pg);
+	BUG_ON(!PageLocked(pg));
 
 	pg_buf = kmap(pg);
 	/* FIXME: Can kmap fail? */
Index: af/include/asm-cris/page.h
===================================================================
--- af.orig/include/asm-cris/page.h	2005-04-01 11:17:38.000000000 -0800
+++ af/include/asm-cris/page.h	2005-04-01 11:17:40.000000000 -0800
@@ -77,10 +77,6 @@ typedef struct { unsigned long pgprot; }
   printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \
 } while (0)
 
-#define PAGE_BUG(page) do { \
-         BUG(); \
-} while (0)
-
 /* Pure 2^n version of get_order */
 static inline int get_order(unsigned long size)
 {
Index: af/fs/udf/file.c
===================================================================
--- af.orig/fs/udf/file.c	2005-04-01 11:17:38.000000000 -0800
+++ af/fs/udf/file.c	2005-04-01 11:17:40.000000000 -0800
@@ -49,8 +49,7 @@ static int udf_adinicb_readpage(struct f
 	struct inode *inode = page->mapping->host;
 	char *kaddr;
 
-	if (!PageLocked(page))
-		PAGE_BUG(page);
+	BUG_ON(!PageLocked(page));
 
 	kaddr = kmap(page);
 	memset(kaddr, 0, PAGE_CACHE_SIZE);
@@ -67,8 +66,7 @@ static int udf_adinicb_writepage(struct 
 	struct inode *inode = page->mapping->host;
 	char *kaddr;
 
-	if (!PageLocked(page))
-		PAGE_BUG(page);
+	BUG_ON(!PageLocked(page));
 
 	kaddr = kmap(page);
 	memcpy(UDF_I_DATA(inode) + UDF_I_LENEATTR(inode), kaddr, inode->i_size);
Index: af/fs/udf/inode.c
===================================================================
--- af.orig/fs/udf/inode.c	2005-04-01 11:17:38.000000000 -0800
+++ af/fs/udf/inode.c	2005-04-01 11:17:40.000000000 -0800
@@ -167,8 +167,8 @@ void udf_expand_file_adinicb(struct inod
 	}
 
 	page = grab_cache_page(inode->i_mapping, 0);
-	if (!PageLocked(page))
-		PAGE_BUG(page);
+	BUG_ON(!PageLocked(page));
+
 	if (!PageUptodate(page))
 	{
 		kaddr = kmap(page);
Index: af/arch/arm26/mm/small_page.c
===================================================================
--- af.orig/arch/arm26/mm/small_page.c	2005-04-01 11:17:38.000000000 -0800
+++ af/arch/arm26/mm/small_page.c	2005-04-01 11:17:40.000000000 -0800
@@ -92,8 +92,7 @@ static unsigned long __get_small_page(in
 		page = list_entry(order->queue.next, struct page, lru);
 again:
 #ifdef PEDANTIC
-		if (USED_MAP(page) & ~order->all_used)
-			PAGE_BUG(page);
+		BUG_ON(USED_MAP(page) & ~order->all_used);
 #endif
 		offset = ffz(USED_MAP(page));
 		SET_USED(page, offset);
@@ -141,8 +140,7 @@ static void __free_small_page(unsigned l
 			goto non_small;
 
 #ifdef PEDANTIC
-		if (USED_MAP(page) & ~order->all_used)
-			PAGE_BUG(page);
+		BUG_ON(USED_MAP(page) & ~order->all_used);
 #endif
 
 		spage = spage >> order->shift;
Index: af/mm/filemap.c
===================================================================
--- af.orig/mm/filemap.c	2005-04-01 11:17:38.000000000 -0800
+++ af/mm/filemap.c	2005-04-01 11:17:40.000000000 -0800
@@ -123,8 +123,7 @@ void remove_from_page_cache(struct page 
 {
 	struct address_space *mapping = page->mapping;
 
-	if (unlikely(!PageLocked(page)))
-		PAGE_BUG(page);
+	BUG_ON(!PageLocked(page));
 
 	write_lock_irq(&mapping->tree_lock);
 	__remove_from_page_cache(page);


-- 
Mathematics is the supreme nostalgia of our time.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] remove all kernel bugs
  2005-04-01  9:17 ` Jan-Benedict Glaw
@ 2005-04-02 21:03   ` Geert Uytterhoeven
  2005-04-02 21:20     ` Jan-Benedict Glaw
  0 siblings, 1 reply; 6+ messages in thread
From: Geert Uytterhoeven @ 2005-04-02 21:03 UTC (permalink / raw)
  To: Jan-Benedict Glaw
  Cc: Matt Mackall, Andrew Morton, Linus Torvalds, linux-kernel

On Fri, 1 Apr 2005, Jan-Benedict Glaw wrote:
> On Fri, 2005-04-01 01:07:44 -0800, Matt Mackall <mpm@selenic.com>
> wrote in message <20050401090744.GD15453@waste.org>:
> > I've been sitting on this patch for a while, figured it's high time I
> > shared it with the world. This patch eliminates all kernel bugs, trims
> > about 35k off the typical kernel, and makes the system slightly
> > faster. The patch is against the latest bk snapshot, please apply.
> > 
> > Signed-off-by: Matt Mackall <mpm@selenic.com>
> 
> Well, the patch looks fine, but you forgot to also do the VAX-specific
> part. Withoug the BUGs, maybe the VAX kernel would be even faster?

Perhaps it's a good idea to get Linux/VAX merged in mainline first? After that
people will start fixing all your bugs automagically ;-)

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] remove all kernel bugs
  2005-04-02 21:03   ` Geert Uytterhoeven
@ 2005-04-02 21:20     ` Jan-Benedict Glaw
  0 siblings, 0 replies; 6+ messages in thread
From: Jan-Benedict Glaw @ 2005-04-02 21:20 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Matt Mackall, Andrew Morton, Linus Torvalds, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1063 bytes --]

On Sat, 2005-04-02 23:03:14 +0200, Geert Uytterhoeven <geert@linux-m68k.org>
wrote in message <Pine.LNX.4.62.0504022301190.812@numbat.sonytel.be>:
> On Fri, 1 Apr 2005, Jan-Benedict Glaw wrote:
> > Well, the patch looks fine, but you forgot to also do the VAX-specific
> > part. Withoug the BUGs, maybe the VAX kernel would be even faster?
> 
> Perhaps it's a good idea to get Linux/VAX merged in mainline first? After that
> people will start fixing all your bugs automagically ;-)

Maybe we'll work on that, but first we need to get real, up-to-date
userspace and not all this old stuff with uClibc. But we're working on
this. (Currently tracking down an ICE. GCC is fun. A lot of fun and
black magic...)

MfG, JBG

-- 
Jan-Benedict Glaw       jbglaw@lug-owl.de    . +49-172-7608481             _ O _
"Eine Freie Meinung in  einem Freien Kopf    | Gegen Zensur | Gegen Krieg  _ _ O
 fuer einen Freien Staat voll Freier Bürger" | im Internet! |   im Irak!   O O O
ret = do_actions((curr | FREE_SPEECH) & ~(NEW_COPYRIGHT_LAW | DRM | TCPA));

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2005-04-02 21:48 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-04-01  9:07 [PATCH] remove all kernel bugs Matt Mackall
2005-04-01  9:17 ` Jan-Benedict Glaw
2005-04-02 21:03   ` Geert Uytterhoeven
2005-04-02 21:20     ` Jan-Benedict Glaw
2005-04-01  9:34 ` Andrew Morton
2005-04-01 20:06   ` Matt Mackall

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox