Skip to contentSkip to conversation

include KERN_* constant in printk() calls in mm/slab.c

PATCH In review Matthias Kaehlcke 6 participants 11 messages Apr 9, 2007 – Apr 10, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 include KERN_* constant in printk() calls in mm/slab.c

hi,

this is my first janitorial. please let me know your suggestions if you notice something incorrect or improvable.

the patch is against v2.6.21-rc6

---

include KERN_* constant in printk() calls in mm/slab.c

---

mm/slab.c +9 -9
index 4cbac24..616c240 100644
@@ -1732,9 +1732,9 @@ static void dump_line(char *data, int offset, int limit)
 			error = data[offset + i];
 			bad_count++;
 		}
-		printk(" %02x", (unsigned char)data[offset + i]);
+		printk(KERN_ERR " %02x", (unsigned char)data[offset + i]);
 	}
-	printk("\n");
+	printk(KERN_ERR "\n");
 
 	if (bad_count = 1) {
 		error ^= POISON_FREE;
@@ -1770,7 +1770,7 @@ static void print_objinfo(struct kmem_cache *cachep, void *objp, int lines)
 			*dbg_userword(cachep, objp));
 		print_symbol("(%s)",
 				(unsigned long)*dbg_userword(cachep, objp));
-		printk("\n");
+		printk(KERN_ERR "\n");
 	}
 	realobj = (char *)objp + obj_offset(cachep);
 	size = obj_size(cachep);
@@ -2151,13 +2151,13 @@ kmem_cache_create (const char *name, size_t size, size_t align,
 		 */
 		res = probe_kernel_address(pc->name, tmp);
 		if (res) {
-			printk("SLAB: cache with size %d has lost its name\n",
+			printk(KERN_WARNING "SLAB: cache with size %d has lost its name\n",
 			       pc->buffer_size);
 			continue;
 		}
 
 		if (!strcmp(pc->name, name)) {
-			printk("kmem_cache_create: duplicate cache %s\n", name);
+			printk(KERN_WARNING "kmem_cache_create: duplicate cache %s\n", name);
 			dump_stack();
 			goto oops;
 		}
@@ -2294,7 +2294,7 @@ kmem_cache_create (const char *name, size_t size, size_t align,
 	left_over = calculate_slab_order(cachep, size, align, flags);
 
 	if (!cachep->num) {
-		printk("kmem_cache_create: couldn't create cache %s.\n", name);
+		printk(KERN_WARNING "kmem_cache_create: couldn't create cache %s.\n", name);
 		kmem_cache_free(&cache_cache, cachep);
 		cachep = NULL;
 		goto oops;
@@ -2929,10 +2929,10 @@ bad:
 		     i < sizeof(*slabp) + cachep->num * sizeof(kmem_bufctl_t);
 		     i++) {
 			if (i % 16 = 0)
-				printk("\n%03x:", i);
-			printk(" %02x", ((unsigned char *)slabp)[i]);
+				printk(KERN_ERR "\n%03x:", i);
+			printk(KERN_ERR " %02x", ((unsigned char *)slabp)[i]);
 		}
-		printk("\n");
+		printk(KERN_ERR "\n");
 		BUG();
 	}
 }
Signature · 14 lines
Matthias Kaehlcke
Linux Application Developer
Barcelona

      El trabajo es el refugio de los que no tienen nada que hacer
                            (Oscar Wilde)
                                                                 .''`.
    using free software / Debian GNU/Linux | http://debian.org  : :'  :
                                                                `. `'`
gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4                  `-
_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors
#1 lore raw

Re: [KJ] [PATCH] include KERN_* constant in printk() calls in

Quoted 20 lines · Matthias Kaehlcke

hi,

this is my first janitorial. please let me know your suggestions if you notice something incorrect or improvable.

the patch is against v2.6.21-rc6

---

include KERN_* constant in printk() calls in mm/slab.c

---

mm/slab.c +0 -0
index 4cbac24..616c240 100644

mm/slab.c static void dump_line(char *data, int offset, int limit) · line 1736

Quoted 6 lines
mm/slab.c +1 -1
@@ -1732,9 +1732,9 @@ static void dump_line(char *data, int offset, int limit)
 			error = data[offset + i];
 			bad_count++;
 		}
-		printk(" %02x", (unsigned char)data[offset + i]);
+		printk(KERN_ERR " %02x", (unsigned char)data[offset + i]);
 	}

This one is wrong. It's printing a bunch of numbers in a loop, so with your change it'll print for example...

KERN_ERR 00 KERN_ERR 01 KERN_ERR 02 KERN_ERR etc etc..

you only want the KERN_ERR at the beginning of each line.

mm/slab.c static void dump_line(char *data, int offset, int limit) · line 1737

Quoted 2 lines
mm/slab.c +1 -1
-	printk("\n");
+	printk(KERN_ERR "\n");

Likewise, only needed at the beginning of a line.

mm/slab.c static void print_objinfo(struct kmem_cache *cachep, void *objp, int lines) · line 1773

Quoted 8 lines
mm/slab.c +1 -1
 	if (bad_count = 1) {
 		error ^= POISON_FREE;
@@ -1770,7 +1770,7 @@ static void print_objinfo(struct kmem_cache *cachep, void *objp, int lines)
 			*dbg_userword(cachep, objp));
 		print_symbol("(%s)",
 				(unsigned long)*dbg_userword(cachep, objp));
-		printk("\n");
+		printk(KERN_ERR "\n");

same.

mm/slab.c kmem_cache_create (const char *name, size_t size, size_t align, · line 2157

Quoted 11 lines
mm/slab.c +1 -1
 	realobj = (char *)objp + obj_offset(cachep);
 	size = obj_size(cachep);
@@ -2151,13 +2151,13 @@ kmem_cache_create (const char *name, size_t size, size_t align,
 		 */
 		res = probe_kernel_address(pc->name, tmp);
 		if (res) {
-			printk("SLAB: cache with size %d has lost its name\n",
+			printk(KERN_WARNING "SLAB: cache with size %d has lost its name\n",
 			       pc->buffer_size);
 			continue;
 		}

this one looks ok, though KERN_ERR imo.

mm/slab.c kmem_cache_create (const char *name, size_t size, size_t align, · line 2163

Quoted 6 lines
mm/slab.c +1 -1
 		if (!strcmp(pc->name, name)) {
-			printk("kmem_cache_create: duplicate cache %s\n", name);
+			printk(KERN_WARNING "kmem_cache_create: duplicate cache %s\n", name);
 			dump_stack();
 			goto oops;
 		}

ditto

mm/slab.c kmem_cache_create (const char *name, size_t size, size_t align, · line 2300

Quoted 9 lines
mm/slab.c +1 -1
@@ -2294,7 +2294,7 @@ kmem_cache_create (const char *name, size_t size, size_t align,
 	left_over = calculate_slab_order(cachep, size, align, flags);
 
 	if (!cachep->num) {
-		printk("kmem_cache_create: couldn't create cache %s.\n", name);
+		printk(KERN_WARNING "kmem_cache_create: couldn't create cache %s.\n", name);
 		kmem_cache_free(&cache_cache, cachep);
 		cachep = NULL;
 		goto oops;

ditto

mm/slab.c bad: · line 2936

Quoted 12 lines
mm/slab.c +3 -3
@@ -2929,10 +2929,10 @@ bad:
 		     i < sizeof(*slabp) + cachep->num * sizeof(kmem_bufctl_t);
 		     i++) {
 			if (i % 16 = 0)
-				printk("\n%03x:", i);
-			printk(" %02x", ((unsigned char *)slabp)[i]);
+				printk(KERN_ERR "\n%03x:", i);
+			printk(KERN_ERR " %02x", ((unsigned char *)slabp)[i]);
 		}
-		printk("\n");
+		printk(KERN_ERR "\n");
 		BUG();

In a loop again, so not ok.

Dave

Signature · 5 lines
http://www.codemonkey.org.uk
_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors
#2 lore raw

Re: [KJ] [PATCH] include KERN_* constant in printk() calls in

In reply to Matthias Kaehlcke

El Mon, Apr 09, 2007 at 04:02:09PM -0400 Dave Jones ha dit:

Quoted 31 lines · Matthias Kaehlcke
Quoted 20 lines

hi,

this is my first janitorial. please let me know your suggestions if you notice something incorrect or improvable.

the patch is against v2.6.21-rc6

---

include KERN_* constant in printk() calls in mm/slab.c

---

mm/slab.c +0 -0
index 4cbac24..616c240 100644

mm/slab.c static void dump_line(char *data, int offset, int limit) · line 1736

Quoted 6 lines
mm/slab.c +1 -1
@@ -1732,9 +1732,9 @@ static void dump_line(char *data, int offset, int limit)
 			error = data[offset + i];
 			bad_count++;
 		}
-		printk(" %02x", (unsigned char)data[offset + i]);
+		printk(KERN_ERR " %02x", (unsigned char)data[offset + i]);
 	}

This one is wrong. It's printing a bunch of numbers in a loop, so with your change it'll print for example...

Quoted 3 lines

KERN_ERR 00 KERN_ERR 01 KERN_ERR 02 KERN_ERR etc etc..

you only want the KERN_ERR at the beginning of each line.

thanks for the information, i didn't realize printk works this way

Quoted 16 lines

mm/slab.c static void dump_line(char *data, int offset, int limit) · line 1737

Quoted 2 lines
mm/slab.c +1 -1
-	printk("\n");
+	printk(KERN_ERR "\n");

Likewise, only needed at the beginning of a line.

mm/slab.c static void print_objinfo(struct kmem_cache *cachep, void *objp, int lines) · line 1773

Quoted 8 lines
mm/slab.c +1 -1
 	if (bad_count = 1) {
 		error ^= POISON_FREE;
@@ -1770,7 +1770,7 @@ static void print_objinfo(struct kmem_cache *cachep, void *objp, int lines)
 			*dbg_userword(cachep, objp));
 		print_symbol("(%s)",
 				(unsigned long)*dbg_userword(cachep, objp));
-		printk("\n");
+		printk(KERN_ERR "\n");

same.

Quoted 13 lines

mm/slab.c kmem_cache_create (const char *name, size_t size, size_t align, · line 2157

Quoted 11 lines
mm/slab.c +1 -1
 	realobj = (char *)objp + obj_offset(cachep);
 	size = obj_size(cachep);
@@ -2151,13 +2151,13 @@ kmem_cache_create (const char *name, size_t size, size_t align,
 		 */
 		res = probe_kernel_address(pc->name, tmp);
 		if (res) {
-			printk("SLAB: cache with size %d has lost its name\n",
+			printk(KERN_WARNING "SLAB: cache with size %d has lost its name\n",
 			       pc->buffer_size);
 			continue;
 		}

this one looks ok, though KERN_ERR imo.

i was in doubt also and finally put KERN_WARNING cause it's the current default. but i agree, will change it to KERN_ERR

Quoted 21 lines

mm/slab.c kmem_cache_create (const char *name, size_t size, size_t align, · line 2163

Quoted 6 lines
mm/slab.c +1 -1
 		if (!strcmp(pc->name, name)) {
-			printk("kmem_cache_create: duplicate cache %s\n", name);
+			printk(KERN_WARNING "kmem_cache_create: duplicate cache %s\n", name);
 			dump_stack();
 			goto oops;
 		}

ditto

mm/slab.c kmem_cache_create (const char *name, size_t size, size_t align, · line 2300

Quoted 9 lines
mm/slab.c +1 -1
@@ -2294,7 +2294,7 @@ kmem_cache_create (const char *name, size_t size, size_t align,
 	left_over = calculate_slab_order(cachep, size, align, flags);
 
 	if (!cachep->num) {
-		printk("kmem_cache_create: couldn't create cache %s.\n", name);
+		printk(KERN_WARNING "kmem_cache_create: couldn't create cache %s.\n", name);
 		kmem_cache_free(&cache_cache, cachep);
 		cachep = NULL;
 		goto oops;

ditto

Quoted 14 lines

mm/slab.c bad: · line 2936

Quoted 12 lines
mm/slab.c +3 -3
@@ -2929,10 +2929,10 @@ bad:
 		     i < sizeof(*slabp) + cachep->num * sizeof(kmem_bufctl_t);
 		     i++) {
 			if (i % 16 = 0)
-				printk("\n%03x:", i);
-			printk(" %02x", ((unsigned char *)slabp)[i]);
+				printk(KERN_ERR "\n%03x:", i);
+			printk(KERN_ERR " %02x", ((unsigned char *)slabp)[i]);
 		}
-		printk("\n");
+		printk(KERN_ERR "\n");
 		BUG();

In a loop again, so not ok.

thanks a lot for your comments

Signature · 15 lines
Matthias Kaehlcke
Linux Application Developer
Barcelona


  The salvation of mankind lies only in making everything the concern of all
                         (Alexander Solzhenitsyn)
                                                                 .''`.
    using free software / Debian GNU/Linux | http://debian.org  : :'  :
                                                                `. `'`
gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4                  `-
_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors
#3 lore raw

Re: [KJ] [PATCH] include KERN_* constant in printk() calls in

In reply to Matthias Kaehlcke

here comes v0.02 of the patch, i hope it is more useful than the first one

---

include KERN_* constant in printk() calls in mm/slab.c

---

mm/slab.c +3 -3
index 4cbac24..7eb1a93 100644
@@ -2151,13 +2151,13 @@ kmem_cache_create (const char *name, size_t size, size_t align,
 		 */
 		res = probe_kernel_address(pc->name, tmp);
 		if (res) {
-			printk("SLAB: cache with size %d has lost its name\n",
+			printk(KERN_ERR "SLAB: cache with size %d has lost its name\n",
 			       pc->buffer_size);
 			continue;
 		}
 
 		if (!strcmp(pc->name, name)) {
-			printk("kmem_cache_create: duplicate cache %s\n", name);
+			printk(KERN_ERR "kmem_cache_create: duplicate cache %s\n", name);
 			dump_stack();
 			goto oops;
 		}
@@ -2294,7 +2294,7 @@ kmem_cache_create (const char *name, size_t size, size_t align,
 	left_over = calculate_slab_order(cachep, size, align, flags);
 
 	if (!cachep->num) {
-		printk("kmem_cache_create: couldn't create cache %s.\n", name);
+		printk(KERN_ERR "kmem_cache_create: couldn't create cache %s.\n", name);
 		kmem_cache_free(&cache_cache, cachep);
 		cachep = NULL;
 		goto oops;

El Mon, Apr 09, 2007 at 10:08:26PM +0200 Matthias Kaehlcke ha dit:

Quoted 110 lines

El Mon, Apr 09, 2007 at 04:02:09PM -0400 Dave Jones ha dit:

Quoted 31 lines · Matthias Kaehlcke
Quoted 20 lines

hi,

this is my first janitorial. please let me know your suggestions if you notice something incorrect or improvable.

the patch is against v2.6.21-rc6

---

include KERN_* constant in printk() calls in mm/slab.c

---

mm/slab.c +0 -0
index 4cbac24..616c240 100644

mm/slab.c static void dump_line(char *data, int offset, int limit) · line 1736

Quoted 6 lines
mm/slab.c +1 -1
@@ -1732,9 +1732,9 @@ static void dump_line(char *data, int offset, int limit)
 			error = data[offset + i];
 			bad_count++;
 		}
-		printk(" %02x", (unsigned char)data[offset + i]);
+		printk(KERN_ERR " %02x", (unsigned char)data[offset + i]);
 	}

This one is wrong. It's printing a bunch of numbers in a loop, so with your change it'll print for example...

Quoted 3 lines

KERN_ERR 00 KERN_ERR 01 KERN_ERR 02 KERN_ERR etc etc..

you only want the KERN_ERR at the beginning of each line.

thanks for the information, i didn't realize printk works this way

Quoted 16 lines

mm/slab.c static void dump_line(char *data, int offset, int limit) · line 1737

Quoted 2 lines
mm/slab.c +1 -1
-	printk("\n");
+	printk(KERN_ERR "\n");

Likewise, only needed at the beginning of a line.

mm/slab.c static void print_objinfo(struct kmem_cache *cachep, void *objp, int lines) · line 1773

Quoted 8 lines
mm/slab.c +1 -1
 	if (bad_count = 1) {
 		error ^= POISON_FREE;
@@ -1770,7 +1770,7 @@ static void print_objinfo(struct kmem_cache *cachep, void *objp, int lines)
 			*dbg_userword(cachep, objp));
 		print_symbol("(%s)",
 				(unsigned long)*dbg_userword(cachep, objp));
-		printk("\n");
+		printk(KERN_ERR "\n");

same.

Quoted 13 lines

mm/slab.c kmem_cache_create (const char *name, size_t size, size_t align, · line 2157

Quoted 11 lines
mm/slab.c +1 -1
 	realobj = (char *)objp + obj_offset(cachep);
 	size = obj_size(cachep);
@@ -2151,13 +2151,13 @@ kmem_cache_create (const char *name, size_t size, size_t align,
 		 */
 		res = probe_kernel_address(pc->name, tmp);
 		if (res) {
-			printk("SLAB: cache with size %d has lost its name\n",
+			printk(KERN_WARNING "SLAB: cache with size %d has lost its name\n",
 			       pc->buffer_size);
 			continue;
 		}

this one looks ok, though KERN_ERR imo.

i was in doubt also and finally put KERN_WARNING cause it's the current default. but i agree, will change it to KERN_ERR

Quoted 21 lines

mm/slab.c kmem_cache_create (const char *name, size_t size, size_t align, · line 2162

Quoted 6 lines
mm/slab.c +1 -1
 		if (!strcmp(pc->name, name)) {
-			printk("kmem_cache_create: duplicate cache %s\n", name);
+			printk(KERN_WARNING "kmem_cache_create: duplicate cache %s\n", name);
 			dump_stack();
 			goto oops;
 		}

ditto

mm/slab.c kmem_cache_create (const char *name, size_t size, size_t align, · line 2300

Quoted 9 lines
mm/slab.c +1 -1
@@ -2294,7 +2294,7 @@ kmem_cache_create (const char *name, size_t size, size_t align,
 	left_over = calculate_slab_order(cachep, size, align, flags);
 
 	if (!cachep->num) {
-		printk("kmem_cache_create: couldn't create cache %s.\n", name);
+		printk(KERN_WARNING "kmem_cache_create: couldn't create cache %s.\n", name);
 		kmem_cache_free(&cache_cache, cachep);
 		cachep = NULL;
 		goto oops;

ditto

Quoted 14 lines

mm/slab.c bad: · line 2936

Quoted 12 lines
mm/slab.c +3 -3
@@ -2929,10 +2929,10 @@ bad:
 		     i < sizeof(*slabp) + cachep->num * sizeof(kmem_bufctl_t);
 		     i++) {
 			if (i % 16 = 0)
-				printk("\n%03x:", i);
-			printk(" %02x", ((unsigned char *)slabp)[i]);
+				printk(KERN_ERR "\n%03x:", i);
+			printk(KERN_ERR " %02x", ((unsigned char *)slabp)[i]);
 		}
-		printk("\n");
+		printk(KERN_ERR "\n");
 		BUG();

In a loop again, so not ok.

thanks a lot for your comments

Signature · 14 lines
Matthias Kaehlcke
Linux Application Developer
Barcelona

              Comunicar bichos a <[email protected]>
                     (LANG=es_ES uname --help)
                                                                 .''`.
    using free software / Debian GNU/Linux | http://debian.org  : :'  :
                                                                `. `'`
gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4                  `-
_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors
#4 lore raw

Re: [KJ] [PATCH] include KERN_* constant in printk() calls in

In reply to Matthias Kaehlcke
Quoted 13 lines · Dave Jones

mm/slab.c static void dump_line(char *data, int offset, int limit) · line 1736

Quoted 9 lines
mm/slab.c +1 -1
@@ -1732,9 +1732,9 @@ static void dump_line(char *data, int offset, int limit)
 			error = data[offset + i];
 			bad_count++;
 		}
-		printk(" %02x", (unsigned char)data[offset + i]);
+		printk(KERN_ERR " %02x", (unsigned char)data[offset + i]);
 	}

This one is wrong. It's printing a bunch of numbers in a loop, so with your change it'll print for example...

Quoted 3 lines

KERN_ERR 00 KERN_ERR 01 KERN_ERR 02 KERN_ERR etc etc..

you only want the KERN_ERR at the beginning of each line.

Another point is that if you have two CPUs calling printk, the output can get interleaved if you don't print everything in one go. If you come across something like this (printing things in a loop), it's a good idea to take a hard look at it and see if you can see a way to do it without the loop so you can print everything on one line.

You can see one example of this here:
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blobdiff;f=drivers/scsi/scsi_scan.c;h0399406510917111b7580dfc8f3a5f1ce7d95d;hpd92b9b46d9ccc5209103beb59cfb75ccafdb5d;hbOf36718ede26ee2da73f2dae94d71e2b06845fc;hpb8cd5bbfb4763322837cd1f7c621f02ebe22fef

I don't see a clean way to fix this one up, to be honest. I think it has to be left as a loop.
_______________________________________________
Kernel-janitors mailing list [email protected]
https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors

#5 lore raw

Re: [KJ] [PATCH] include KERN_* constant in printk() calls in

In reply to Matthias Kaehlcke
Quoted 2 lines · Matthias Kaehlcke

here comes v0.02 of the patch, i hope it is more useful than the first one

You've made the lines go beyond 80 columns.

mm/slab.c kmem_cache_create (const char *name, size_t size, size_t align, · line 2156

Quoted 5 lines
mm/slab.c +1 -1
 		if (res) {
-			printk("SLAB: cache with size %d has lost its name\n",
+			printk(KERN_ERR "SLAB: cache with size %d has lost its name\n",
 			       pc->buffer_size);
 			continue;

Try this instead:

+ printk(KERN_ERR "SLAB: cache with size %d has lost its"
+ " name\n", pc->buffer_size);

(ditto the other changes you made).
_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors

#6 lore raw

Re: [KJ] [PATCH] include KERN_* constant in printk() calls in

In reply to Matthias Kaehlcke

El Mon, Apr 09, 2007 at 03:41:33PM -0600 Matthew Wilcox ha dit:

Quoted 5 lines · Matthias Kaehlcke
Quoted 2 lines

here comes v0.02 of the patch, i hope it is more useful than the first one

You've made the lines go beyond 80 columns.

thanks for your comment. i corrected this in v0.03

--

include KERN_* constant in printk() calls in mm/slab.c

--

mm/slab.c +8 -3
index 4cbac24..d533f0d 100644
@@ -2151,13 +2151,16 @@ kmem_cache_create (const char *name, size_t size, size_t align,
 		 */
 		res = probe_kernel_address(pc->name, tmp);
 		if (res) {
-			printk("SLAB: cache with size %d has lost its name\n",
+			printk(KERN_ERR
+			       "SLAB: cache with size %d has lost its name\n",
 			       pc->buffer_size);
 			continue;
 		}
 
 		if (!strcmp(pc->name, name)) {
-			printk("kmem_cache_create: duplicate cache %s\n", name);
+			printk(KERN_ERR
+			       "kmem_cache_create: duplicate cache %s\n",
+			       name);
 			dump_stack();
 			goto oops;
 		}
@@ -2294,7 +2297,9 @@ kmem_cache_create (const char *name, size_t size, size_t align,
 	left_over = calculate_slab_order(cachep, size, align, flags);
 
 	if (!cachep->num) {
-		printk("kmem_cache_create: couldn't create cache %s.\n", name);
+		printk(KERN_ERR
+		       "kmem_cache_create: couldn't create cache %s.\n",
+		       name);
 		kmem_cache_free(&cache_cache, cachep);
 		cachep = NULL;
 		goto oops;
Signature · 15 lines
Matthias Kaehlcke
Linux Application Developer
Barcelona

    C treats you like a consenting adult. Pascal treats you like a
          naughty child. Ada treats you like a criminal
                      (Bruce Powel Douglass)
                                                                 .''`.
    using free software / Debian GNU/Linux | http://debian.org  : :'  :
                                                                `. `'`
gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4                  `-
_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors
#7 lore raw

Re: [KJ] [PATCH] include KERN_* constant in printk() calls in

In reply to Matthias Kaehlcke
Quoted 11 lines · Dave Jones

mm/slab.c static void dump_line(char *data, int offset, int limit) · line 1736

Quoted 3 lines · Matthias Kaehlcke
mm/slab.c +1 -1
-		printk(" %02x", (unsigned char)data[offset + i]);
+		printk(KERN_ERR " %02x", (unsigned char)data[offset + i]);
 	}

This one is wrong. It's printing a bunch of numbers in a loop, so with your change it'll print for example...

KERN_ERR 00 KERN_ERR 01 KERN_ERR 02 KERN_ERR etc etc..

you only want the KERN_ERR at the beginning of each line.

Am I the only one who wants config option to nop all these KERN_* stuff ? (with only possible exception probably being KERN_DEBUG)

_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors

#8 lore raw

Re: [KJ] [PATCH] include KERN_* constant in printk() calls in

In reply to Matthias Kaehlcke
Quoted 6 lines · Alexey Dobriyan
Quoted 5 lines · Dave Jones
Quoted 3 lines · Matthias Kaehlcke
mm/slab.c +1 -1
-		printk(" %02x", (unsigned char)data[offset + i]);
+		printk(KERN_ERR " %02x", (unsigned char)data[offset + i]);
 	}
Quoted 8 lines
Quoted 6 lines

This one is wrong. It's printing a bunch of numbers in a loop, so with your change it'll print for example...

KERN_ERR 00 KERN_ERR 01 KERN_ERR 02 KERN_ERR etc etc..

you only want the KERN_ERR at the beginning of each line.

Am I the only one who wants config option to nop all these KERN_* stuff ?

probably ;)
Trivial to do though, but I doubt it'll save more than a page or so on most configurations, and for those that really care about being tight on space (embedded for eg), they've usually disabled huge swathes of kernel code, so the number of printk's is reduced, reducing the space savings from this idea also..

Dave

Signature · 5 lines
http://www.codemonkey.org.uk
_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors
#9 lore raw

Re: [KJ] [PATCH] include KERN_* constant in printk() calls in

In reply to Matthias Kaehlcke
Quoted 14 lines · Dave Jones
Quoted 13 lines · Alexey Dobriyan
Quoted 11 lines · Dave Jones

mm/slab.c static void dump_line(char *data, int offset, int limit) · line 1736

Quoted 3 lines · Matthias Kaehlcke
mm/slab.c +1 -1
-		printk(" %02x", (unsigned char)data[offset + i]);
+		printk(KERN_ERR " %02x", (unsigned char)data[offset + i]);
 	}

This one is wrong. It's printing a bunch of numbers in a loop, so with your change it'll print for example...

KERN_ERR 00 KERN_ERR 01 KERN_ERR 02 KERN_ERR etc etc..

you only want the KERN_ERR at the beginning of each line.

Quoted 8 lines
Quoted 1 line

Am I the only one who wants config option to nop all these KERN_* stuff ?

probably ;)
Trivial to do though, but I doubt it'll save more than a page or so on most configurations, and for those that really care about being tight on space (embedded for eg), they've usually disabled huge swathes of kernel code, so the number of printk's is reduced, reducing the space savings from this idea also..

or they've simply disabled PRINTK in its entirety.

rday

Signature · 11 lines
====================================
Robert P. J. Day
Linux Consulting, Training and Annoying Kernel Pedantry
Waterloo, Ontario, CANADA

http://fsdev.net/wiki/index.php?title=Main_Page
====================================
_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors
#10 lore raw

Re: [KJ] [PATCH] include KERN_* constant in printk() calls in

In reply to Matthias Kaehlcke
Quoted 9 lines · On Wed, 11 Apr 2007 01:07:06 +0400 Alexey Dobriyan wrote:
Quoted 8 lines · Dave Jones

mm/slab.c static void dump_line(char *data, int offset, int limit) · line 1736

Quoted 3 lines · Matthias Kaehlcke
mm/slab.c +1 -1
-		printk(" %02x", (unsigned char)data[offset + i]);
+		printk(KERN_ERR " %02x", (unsigned char)data[offset + i]);
 	}

This one is wrong. It's printing a bunch of numbers in a loop, so with your change it'll print for example...

Quoted 6 lines
Quoted 3 lines

KERN_ERR 00 KERN_ERR 01 KERN_ERR 02 KERN_ERR etc etc..

you only want the KERN_ERR at the beginning of each line.

Am I the only one who wants config option to nop all these KERN_* stuff ? (with only possible exception probably being KERN_DEBUG)

For what purpose?
I use boot option "ignore_loglevel" to ignore that KERN_* stuff.

---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***
_______________________________________________
Kernel-janitors mailing list [email protected]
https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors