[PATCH] removes unnessary print of space

6 views
Skip to first unread message

Kirill Korotaev

unread,
Sep 6, 2004, 2:58:15 AM9/6/04
to linux-...@vger.kernel.org, ak...@osdl.org, torv...@osdl.org
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.

Kirill

diff-oops-printk

Andrew Morton

unread,
Sep 6, 2004, 3:14:42 AM9/6/04
to Kirill Korotaev, linux-...@vger.kernel.org, torv...@osdl.org
Kirill Korotaev <d...@sw.ru> 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.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majo...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Kalin KOZHUHAROV

unread,
Sep 6, 2004, 4:06:56 AM9/6/04
to linux-...@vger.kernel.org
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/ ( )
|| ______________________ ||

Kirill Korotaev

unread,
Sep 6, 2004, 4:25:12 AM9/6/04
to Andrew Morton, linux-...@vger.kernel.org
>>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

Andrew Morton

unread,
Sep 6, 2004, 4:35:11 AM9/6/04
to Kirill Korotaev, linux-...@vger.kernel.org
Kirill Korotaev <d...@sw.ru> 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.

Tonnerre

unread,
Sep 6, 2004, 5:07:16 AM9/6/04
to Kalin KOZHUHAROV, linux-...@vger.kernel.org
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

signature.asc

Chris Wedgwood

unread,
Sep 6, 2004, 8:20:19 AM9/6/04
to Andrew Morton, Kirill Korotaev, linux-...@vger.kernel.org, torv...@osdl.org
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

Randy.Dunlap

unread,
Sep 6, 2004, 12:35:28 PM9/6/04
to Kirill Korotaev, ak...@osdl.org, linux-...@vger.kernel.org
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

Reply all
Reply to author
Forward
0 new messages