* Re: [KJ] [PATCH] include KERN_* constant in printk() calls in
2007-04-09 19:41 [KJ] [PATCH] include KERN_* constant in printk() calls in mm/slab.c Matthias Kaehlcke
@ 2007-04-09 20:02 ` Dave Jones
2007-04-09 20:08 ` Matthias Kaehlcke
` (9 subsequent siblings)
10 siblings, 0 replies; 13+ messages in thread
From: Dave Jones @ 2007-04-09 20:02 UTC (permalink / raw)
To: kernel-janitors
On Mon, Apr 09, 2007 at 09:41:51PM +0200, Matthias Kaehlcke wrote:
> 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
>
> Signed-off-by: Matthias Kaehlcke <matthias.kaehlcke@gmail.com>
>
> ---
>
> diff --git a/mm/slab.c b/mm/slab.c
> index 4cbac24..616c240 100644
> --- a/mm/slab.c
> +++ b/mm/slab.c
> @@ -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.
> - printk("\n");
> + printk(KERN_ERR "\n");
Likewise, only needed at the beginning of a line.
> 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.
> 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.
> 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
> @@ -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
> @@ -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
--
http://www.codemonkey.org.uk
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: [KJ] [PATCH] include KERN_* constant in printk() calls in
2007-04-09 19:41 [KJ] [PATCH] include KERN_* constant in printk() calls in mm/slab.c Matthias Kaehlcke
2007-04-09 20:02 ` [KJ] [PATCH] include KERN_* constant in printk() calls in Dave Jones
@ 2007-04-09 20:08 ` Matthias Kaehlcke
2007-04-09 20:53 ` Matthias Kaehlcke
` (8 subsequent siblings)
10 siblings, 0 replies; 13+ messages in thread
From: Matthias Kaehlcke @ 2007-04-09 20:08 UTC (permalink / raw)
To: kernel-janitors
El Mon, Apr 09, 2007 at 04:02:09PM -0400 Dave Jones ha dit:
> On Mon, Apr 09, 2007 at 09:41:51PM +0200, Matthias Kaehlcke wrote:
> > 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
> >
> > Signed-off-by: Matthias Kaehlcke <matthias.kaehlcke@gmail.com>
> >
> > ---
> >
> > diff --git a/mm/slab.c b/mm/slab.c
> > index 4cbac24..616c240 100644
> > --- a/mm/slab.c
> > +++ b/mm/slab.c
> > @@ -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.
thanks for the information, i didn't realize printk works this way
> > - printk("\n");
> > + printk(KERN_ERR "\n");
>
> Likewise, only needed at the beginning of a line.
>
> > 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.
>
> > 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
> > 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
>
> > @@ -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
>
> > @@ -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
--
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
Kernel-janitors@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: [KJ] [PATCH] include KERN_* constant in printk() calls in
2007-04-09 19:41 [KJ] [PATCH] include KERN_* constant in printk() calls in mm/slab.c Matthias Kaehlcke
2007-04-09 20:02 ` [KJ] [PATCH] include KERN_* constant in printk() calls in Dave Jones
2007-04-09 20:08 ` Matthias Kaehlcke
@ 2007-04-09 20:53 ` Matthias Kaehlcke
2007-04-09 21:23 ` Matthew Wilcox
` (7 subsequent siblings)
10 siblings, 0 replies; 13+ messages in thread
From: Matthias Kaehlcke @ 2007-04-09 20:53 UTC (permalink / raw)
To: kernel-janitors
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
Signed-off-by: Matthias Kaehlcke <matthias.kaehlcke@gmail.com>
---
diff --git a/mm/slab.c b/mm/slab.c
index 4cbac24..7eb1a93 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -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:
> El Mon, Apr 09, 2007 at 04:02:09PM -0400 Dave Jones ha dit:
>
> > On Mon, Apr 09, 2007 at 09:41:51PM +0200, Matthias Kaehlcke wrote:
> > > 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
> > >
> > > Signed-off-by: Matthias Kaehlcke <matthias.kaehlcke@gmail.com>
> > >
> > > ---
> > >
> > > diff --git a/mm/slab.c b/mm/slab.c
> > > index 4cbac24..616c240 100644
> > > --- a/mm/slab.c
> > > +++ b/mm/slab.c
> > > @@ -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.
>
> thanks for the information, i didn't realize printk works this way
>
> > > - printk("\n");
> > > + printk(KERN_ERR "\n");
> >
> > Likewise, only needed at the beginning of a line.
> >
> > > 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.
> >
> > > 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
>
> > > 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
> >
> > > @@ -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
> >
> > > @@ -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
>
--
Matthias Kaehlcke
Linux Application Developer
Barcelona
Comunicar bichos a <bug-coreutils@gnu.org>
(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
Kernel-janitors@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors
^ permalink raw reply related [flat|nested] 13+ messages in thread* Re: [KJ] [PATCH] include KERN_* constant in printk() calls in
2007-04-09 19:41 [KJ] [PATCH] include KERN_* constant in printk() calls in mm/slab.c Matthias Kaehlcke
` (2 preceding siblings ...)
2007-04-09 20:53 ` Matthias Kaehlcke
@ 2007-04-09 21:23 ` Matthew Wilcox
2007-04-09 21:41 ` Matthew Wilcox
` (6 subsequent siblings)
10 siblings, 0 replies; 13+ messages in thread
From: Matthew Wilcox @ 2007-04-09 21:23 UTC (permalink / raw)
To: kernel-janitors
On Mon, Apr 09, 2007 at 04:02:09PM -0400, Dave Jones wrote:
> > --- a/mm/slab.c
> > +++ b/mm/slab.c
> > @@ -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.
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;h\x180399406510917111b7580dfc8f3a5f1ce7d95d;hp^[d92b9b46d9ccc5209103beb59cfb75ccafdb5d;hbOf36718ede26ee2da73f2dae94d71e2b06845fc;hpb\08cd5bbfb4763322837cd1f7c621f02ebe22fef
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
Kernel-janitors@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: [KJ] [PATCH] include KERN_* constant in printk() calls in
2007-04-09 19:41 [KJ] [PATCH] include KERN_* constant in printk() calls in mm/slab.c Matthias Kaehlcke
` (3 preceding siblings ...)
2007-04-09 21:23 ` Matthew Wilcox
@ 2007-04-09 21:41 ` Matthew Wilcox
2007-04-10 6:48 ` Matthias Kaehlcke
` (5 subsequent siblings)
10 siblings, 0 replies; 13+ messages in thread
From: Matthew Wilcox @ 2007-04-09 21:41 UTC (permalink / raw)
To: kernel-janitors
On Mon, Apr 09, 2007 at 10:53:21PM +0200, Matthias Kaehlcke wrote:
> 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.
> 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
Kernel-janitors@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: [KJ] [PATCH] include KERN_* constant in printk() calls in
2007-04-09 19:41 [KJ] [PATCH] include KERN_* constant in printk() calls in mm/slab.c Matthias Kaehlcke
` (4 preceding siblings ...)
2007-04-09 21:41 ` Matthew Wilcox
@ 2007-04-10 6:48 ` Matthias Kaehlcke
2007-04-10 21:07 ` Alexey Dobriyan
` (4 subsequent siblings)
10 siblings, 0 replies; 13+ messages in thread
From: Matthias Kaehlcke @ 2007-04-10 6:48 UTC (permalink / raw)
To: kernel-janitors
El Mon, Apr 09, 2007 at 03:41:33PM -0600 Matthew Wilcox ha dit:
> On Mon, Apr 09, 2007 at 10:53:21PM +0200, Matthias Kaehlcke wrote:
> > 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
Signed-off-by: Matthias Kaehlcke <matthias.kaehlcke@gmail.com>
--
diff --git a/mm/slab.c b/mm/slab.c
index 4cbac24..d533f0d 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -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;
--
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
Kernel-janitors@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors
^ permalink raw reply related [flat|nested] 13+ messages in thread* Re: [KJ] [PATCH] include KERN_* constant in printk() calls in
2007-04-09 19:41 [KJ] [PATCH] include KERN_* constant in printk() calls in mm/slab.c Matthias Kaehlcke
` (5 preceding siblings ...)
2007-04-10 6:48 ` Matthias Kaehlcke
@ 2007-04-10 21:07 ` Alexey Dobriyan
2007-04-10 21:37 ` Dave Jones
` (3 subsequent siblings)
10 siblings, 0 replies; 13+ messages in thread
From: Alexey Dobriyan @ 2007-04-10 21:07 UTC (permalink / raw)
To: kernel-janitors
On Mon, Apr 09, 2007 at 04:02:09PM -0400, Dave Jones wrote:
> On Mon, Apr 09, 2007 at 09:41:51PM +0200, Matthias Kaehlcke wrote:
> > - 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
Kernel-janitors@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: [KJ] [PATCH] include KERN_* constant in printk() calls in
2007-04-09 19:41 [KJ] [PATCH] include KERN_* constant in printk() calls in mm/slab.c Matthias Kaehlcke
` (6 preceding siblings ...)
2007-04-10 21:07 ` Alexey Dobriyan
@ 2007-04-10 21:37 ` Dave Jones
2007-04-10 21:50 ` Robert P. J. Day
` (2 subsequent siblings)
10 siblings, 0 replies; 13+ messages in thread
From: Dave Jones @ 2007-04-10 21:37 UTC (permalink / raw)
To: kernel-janitors
On Wed, Apr 11, 2007 at 01:07:06AM +0400, Alexey Dobriyan wrote:
> On Mon, Apr 09, 2007 at 04:02:09PM -0400, Dave Jones wrote:
> > On Mon, Apr 09, 2007 at 09:41:51PM +0200, Matthias Kaehlcke wrote:
> > > - 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 ?
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
--
http://www.codemonkey.org.uk
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: [KJ] [PATCH] include KERN_* constant in printk() calls in
2007-04-09 19:41 [KJ] [PATCH] include KERN_* constant in printk() calls in mm/slab.c Matthias Kaehlcke
` (7 preceding siblings ...)
2007-04-10 21:37 ` Dave Jones
@ 2007-04-10 21:50 ` Robert P. J. Day
2007-04-10 21:58 ` Randy Dunlap
2007-04-14 5:50 ` [PATCH] include KERN_* constant in printk() calls in arch/i386/mach-default/setup.c Matthias Kaehlcke
10 siblings, 0 replies; 13+ messages in thread
From: Robert P. J. Day @ 2007-04-10 21:50 UTC (permalink / raw)
To: kernel-janitors
On Tue, 10 Apr 2007, Dave Jones wrote:
> On Wed, Apr 11, 2007 at 01:07:06AM +0400, Alexey Dobriyan wrote:
> > On Mon, Apr 09, 2007 at 04:02:09PM -0400, Dave Jones wrote:
> > > On Mon, Apr 09, 2007 at 09:41:51PM +0200, Matthias Kaehlcke wrote:
> > > > - 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 ?
>
> 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
--
====================================
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
Kernel-janitors@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: [KJ] [PATCH] include KERN_* constant in printk() calls in
2007-04-09 19:41 [KJ] [PATCH] include KERN_* constant in printk() calls in mm/slab.c Matthias Kaehlcke
` (8 preceding siblings ...)
2007-04-10 21:50 ` Robert P. J. Day
@ 2007-04-10 21:58 ` Randy Dunlap
2007-04-14 5:50 ` [PATCH] include KERN_* constant in printk() calls in arch/i386/mach-default/setup.c Matthias Kaehlcke
10 siblings, 0 replies; 13+ messages in thread
From: Randy Dunlap @ 2007-04-10 21:58 UTC (permalink / raw)
To: kernel-janitors
On Wed, 11 Apr 2007 01:07:06 +0400 Alexey Dobriyan wrote:
> On Mon, Apr 09, 2007 at 04:02:09PM -0400, Dave Jones wrote:
> > On Mon, Apr 09, 2007 at 09:41:51PM +0200, Matthias Kaehlcke wrote:
> > > - 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)
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
Kernel-janitors@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors
^ permalink raw reply [flat|nested] 13+ messages in thread* [KJ] [PATCH] include KERN_* constant in printk() calls in
@ 2007-04-14 5:50 ` Matthias Kaehlcke
0 siblings, 0 replies; 13+ messages in thread
From: Matthias Kaehlcke @ 2007-04-11 6:50 UTC (permalink / raw)
To: Linux Kernel Mailing List
include KERN_* constant in printk() calls in arch/i386/mach-default/setup.c
Signed-off-by: Matthias Kaehlcke <matthias.kaehlcke@gmail.com>
---
diff --git a/arch/i386/mach-default/setup.c b/arch/i386/mach-default/setup.c
index c788162..f1891b6 100644
--- a/arch/i386/mach-default/setup.c
+++ b/arch/i386/mach-default/setup.c
@@ -115,15 +115,15 @@ void mca_nmi_hook(void)
* at the moment.
*/
- printk("NMI generated from unknown source!\n");
+ printk(KERN_WARNING "NMI generated from unknown source!\n");
}
#endif
static __init int no_ipi_broadcast(char *str)
{
get_option(&str, &no_broadcast);
- printk ("Using %s mode\n", no_broadcast ? "No IPI Broadcast" :
- "IPI Broadcast");
+ printk(KERN_INFO "Using %s mode\n",
+ no_broadcast ? "No IPI Broadcast" : "IPI Broadcast");
return 1;
}
@@ -131,8 +131,8 @@ __setup("no_ipi_broadcast", no_ipi_broadcast);
static int __init print_ipi_mode(void)
{
- printk ("Using IPI %s mode\n", no_broadcast ? "No-Shortcut" :
- "Shortcut");
+ printk(KERN_INFO "Using IPI %s mode\n",
+ no_broadcast ? "No-Shortcut" : "Shortcut");
return 0;
}
--
Matthias Kaehlcke
Linux Application Developer
Barcelona
Comunicar bichos a <bug-coreutils@gnu.org>
(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
Kernel-janitors@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors
^ permalink raw reply related [flat|nested] 13+ messages in thread* [PATCH] include KERN_* constant in printk() calls in arch/i386/mach-default/setup.c
@ 2007-04-14 5:50 ` Matthias Kaehlcke
0 siblings, 0 replies; 13+ messages in thread
From: Matthias Kaehlcke @ 2007-04-14 5:50 UTC (permalink / raw)
To: Linux Kernel Mailing List
include KERN_* constant in printk() calls in arch/i386/mach-default/setup.c
Signed-off-by: Matthias Kaehlcke <matthias.kaehlcke@gmail.com>
---
diff --git a/arch/i386/mach-default/setup.c b/arch/i386/mach-default/setup.c
index c788162..f1891b6 100644
--- a/arch/i386/mach-default/setup.c
+++ b/arch/i386/mach-default/setup.c
@@ -115,15 +115,15 @@ void mca_nmi_hook(void)
* at the moment.
*/
- printk("NMI generated from unknown source!\n");
+ printk(KERN_WARNING "NMI generated from unknown source!\n");
}
#endif
static __init int no_ipi_broadcast(char *str)
{
get_option(&str, &no_broadcast);
- printk ("Using %s mode\n", no_broadcast ? "No IPI Broadcast" :
- "IPI Broadcast");
+ printk(KERN_INFO "Using %s mode\n",
+ no_broadcast ? "No IPI Broadcast" : "IPI Broadcast");
return 1;
}
@@ -131,8 +131,8 @@ __setup("no_ipi_broadcast", no_ipi_broadcast);
static int __init print_ipi_mode(void)
{
- printk ("Using IPI %s mode\n", no_broadcast ? "No-Shortcut" :
- "Shortcut");
+ printk(KERN_INFO "Using IPI %s mode\n",
+ no_broadcast ? "No-Shortcut" : "Shortcut");
return 0;
}
--
Matthias Kaehlcke
Linux Application Developer
Barcelona
Comunicar bichos a <bug-coreutils@gnu.org>
(LANG=es_ES uname --help)
.''`.
using free software / Debian GNU/Linux | http://debian.org : :' :
`. `'`
gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4 `-
^ permalink raw reply related [flat|nested] 13+ messages in thread