2004-09-06 06:56:08

by Kirill Korotaev

[permalink] [raw]
Subject: [PATCH] removes unnessary print of space

--- ./arch/i386/mm/fault.c.printk 2004-08-14 14:54:46.000000000 +0400
+++ ./arch/i386/mm/fault.c 2004-09-06 11:02:32.730550352 +0400
@@ -51,7 +51,7 @@ void bust_spinlocks(int yes)
* a poke. Hold onto your hats...
*/
console_loglevel = 15; /* NMI oopser may have shut the console up */
- printk(" ");
+ printk("");
console_loglevel = loglevel_save;
}


Attachments:
diff-oops-printk (365.00 B)

2004-09-06 07:10:39

by Andrew Morton

[permalink] [raw]
Subject: Re: [PATCH] removes unnessary print of space

Kirill Korotaev <[email protected]> wrote:
>
> This patch removes unnessary print of space in bust_spinlocks().
> printk("") wakeups klogd as well,

Until some smarty comes along and optimises printk() to skip empty strings.

An explicit wake_up_klogd() thing might make sense, rather than relying
upon side-effects.

> no need to print a space and make a mess.

Can't say that I've ever noticed that space.

2004-09-06 08:00:41

by Kalin KOZHUHAROV

[permalink] [raw]
Subject: Re: [PATCH] removes unnessary print of space

Kirill Korotaev wrote:
> This patch removes unnessary print of space in bust_spinlocks().
> printk("") wakeups klogd as well, no need to print a space
> and make a mess.
>
I may be just a newbie, but why call prink with no arguments?
Does it do something?

> ------------------------------------------------------------------------
>
> --- ./arch/i386/mm/fault.c.printk 2004-08-14 14:54:46.000000000 +0400
> +++ ./arch/i386/mm/fault.c 2004-09-06 11:02:32.730550352 +0400
> @@ -51,7 +51,7 @@ void bust_spinlocks(int yes)
> * a poke. Hold onto your hats...
> */
> console_loglevel = 15; /* NMI oopser may have shut the console up */
> - printk(" ");
> + printk("");
> console_loglevel = loglevel_save;
> }
>

Kalin.
--
|| ~~~~~~~~~~~~~~~~~~~~~~ ||
( ) http://ThinRope.net/ ( )
|| ______________________ ||

2004-09-06 08:22:55

by Kirill Korotaev

[permalink] [raw]
Subject: Re: [PATCH] removes unnessary print of space

>>This patch removes unnessary print of space in bust_spinlocks().
>> printk("") wakeups klogd as well,
>
> Until some smarty comes along and optimises printk() to skip empty strings.
>
> An explicit wake_up_klogd() thing might make sense, rather than relying
> upon side-effects.
yup, you are right. I was the easiest, but not the best.
I'll make a patch with wakeup_klogd.

>>no need to print a space and make a mess.
> Can't say that I've ever noticed that space.
We did. Many times.

I've noticed another thing. There is a default bust_spinlocks() in
lib/bust_spinlocks.c. 4 architectures including x86 have their own
copies of it, which are exactly the same as the default one.

So do we really need lib/bust_spinlocks.c or we can move a signle copy
of this function to kernel/printk.c?

Kirill

2004-09-06 08:32:11

by Andrew Morton

[permalink] [raw]
Subject: Re: [PATCH] removes unnessary print of space

Kirill Korotaev <[email protected]> wrote:
>
> I've noticed another thing. There is a default bust_spinlocks() in
> lib/bust_spinlocks.c. 4 architectures including x86 have their own
> copies of it, which are exactly the same as the default one.
>
> So do we really need lib/bust_spinlocks.c or we can move a signle copy
> of this function to kernel/printk.c?

I'd leave it as is - nobody's complaining.

In the more modern scheme of things we'd move that file to kernel/ and
require that per-arch Kconfigs define CONFIG_NEED_GENERIC_BUST_SPINLOCKS,
then use that in kernel/Makefile. But doing that now would be gratuitous
noise, IMO.

2004-09-06 09:04:51

by Tonnerre

[permalink] [raw]
Subject: Re: [PATCH] removes unnessary print of space

Salut,

On Mon, Sep 06, 2004 at 04:57:55PM +0900, Kalin KOZHUHAROV wrote:
> I may be just a newbie, but why call prink with no arguments?
> Does it do something?

Actually, there is an argument: a NULL terminated string of size 0.

It pokes the klogd. This can be done much better through
wake_up_klogd() though.

Tonnerre


Attachments:
(No filename) (344.00 B)
signature.asc (189.00 B)
Digital signature
Download all attachments

2004-09-06 12:18:38

by Chris Wedgwood

[permalink] [raw]
Subject: Re: [PATCH] removes unnessary print of space

On Mon, Sep 06, 2004 at 12:08:26AM -0700, Andrew Morton wrote:

> Until some smarty comes along and optimises printk() to skip empty
> strings.

define the bahavior to disallow that

> An explicit wake_up_klogd() thing might make sense, rather than
> relying upon side-effects.

what about something like:

#define wake_up_klogd() (printk(NULL))

then? and have printk short-circuit where required when it gets NULL
but still wake the console up?


--cw

2004-09-06 16:34:13

by Randy.Dunlap

[permalink] [raw]
Subject: Re: [PATCH] removes unnessary print of space

On Mon, 06 Sep 2004 12:34:37 +0400 Kirill Korotaev wrote:

| >>This patch removes unnessary print of space in bust_spinlocks().
| >> printk("") wakeups klogd as well,
| >
| > Until some smarty comes along and optimises printk() to skip empty strings.
| >
| > An explicit wake_up_klogd() thing might make sense, rather than relying
| > upon side-effects.
| yup, you are right. I was the easiest, but not the best.
| I'll make a patch with wakeup_klogd.
|
| >>no need to print a space and make a mess.
| > Can't say that I've ever noticed that space.
| We did. Many times.

Same here. Thanks for cleaning it up.

| I've noticed another thing. There is a default bust_spinlocks() in
| lib/bust_spinlocks.c. 4 architectures including x86 have their own
| copies of it, which are exactly the same as the default one.
|
| So do we really need lib/bust_spinlocks.c or we can move a signle copy
| of this function to kernel/printk.c?

--
~Randy