* [PATCH] kill massive wireless-related log spam
@ 2005-10-26 4:28 Jeff Garzik
2005-10-26 15:04 ` Andi Kleen
0 siblings, 1 reply; 7+ messages in thread
From: Jeff Garzik @ 2005-10-26 4:28 UTC (permalink / raw)
To: Linus Torvalds; +Cc: netdev, linux-kernel, jketreno, Andrew Morton
Please apply to 2.6.14-rc.
Although this message is having the intended effect of causing wireless
driver maintainers to upgrade their code, I never should have merged
this patch in its present form. Leading to tons of bug reports and
unhappy users.
Some wireless apps poll for statistics regularly, which leads to a
printk() every single time they ask for stats. That's a little bit
_too_ much of a reminder that the driver is using an old API.
Change this to printing out the message once, per kernel boot.
diff --git a/net/core/wireless.c b/net/core/wireless.c
index d17f158..271ddb3 100644
--- a/net/core/wireless.c
+++ b/net/core/wireless.c
@@ -455,10 +455,15 @@ static inline struct iw_statistics *get_
/* Old location, field to be removed in next WE */
if(dev->get_wireless_stats) {
- printk(KERN_DEBUG "%s (WE) : Driver using old /proc/net/wireless support, please fix driver !\n",
- dev->name);
+ static int printed_message;
+
+ if (!printed_message++)
+ printk(KERN_DEBUG "%s (WE) : Driver using old /proc/net/wireless support, please fix driver !\n",
+ dev->name);
+
return dev->get_wireless_stats(dev);
}
+
/* Not found */
return (struct iw_statistics *) NULL;
}
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH] kill massive wireless-related log spam
2005-10-26 4:28 [PATCH] kill massive wireless-related log spam Jeff Garzik
@ 2005-10-26 15:04 ` Andi Kleen
2005-10-26 15:23 ` Jesper Juhl
2005-10-26 15:42 ` Jeff Garzik
0 siblings, 2 replies; 7+ messages in thread
From: Andi Kleen @ 2005-10-26 15:04 UTC (permalink / raw)
To: Jeff Garzik; +Cc: Linus Torvalds, netdev, linux-kernel, jketreno, Andrew Morton
On Wednesday 26 October 2005 06:28, Jeff Garzik wrote:
> Change this to printing out the message once, per kernel boot.
It doesn't do that. It prints it once every 2^32 calls. Also
the ++ causes unnecessary dirty cache lines in normal operation.
-Andi
>
> diff --git a/net/core/wireless.c b/net/core/wireless.c
> index d17f158..271ddb3 100644
> --- a/net/core/wireless.c
> +++ b/net/core/wireless.c
> @@ -455,10 +455,15 @@ static inline struct iw_statistics *get_
>
> /* Old location, field to be removed in next WE */
> if(dev->get_wireless_stats) {
> - printk(KERN_DEBUG "%s (WE) : Driver using old /proc/net/wireless support, please fix driver !\n",
> - dev->name);
> + static int printed_message;
> +
> + if (!printed_message++)
> + printk(KERN_DEBUG "%s (WE) : Driver using old /proc/net/wireless support, please fix driver !\n",
> + dev->name);
> +
> return dev->get_wireless_stats(dev);
> }
> +
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH] kill massive wireless-related log spam
2005-10-26 15:04 ` Andi Kleen
@ 2005-10-26 15:23 ` Jesper Juhl
2005-10-26 21:23 ` J.A. Magallon
2005-10-26 15:42 ` Jeff Garzik
1 sibling, 1 reply; 7+ messages in thread
From: Jesper Juhl @ 2005-10-26 15:23 UTC (permalink / raw)
To: Andi Kleen
Cc: Jeff Garzik, Linus Torvalds, netdev, linux-kernel, jketreno,
Andrew Morton
On 10/26/05, Andi Kleen <ak@suse.de> wrote:
> On Wednesday 26 October 2005 06:28, Jeff Garzik wrote:
>
> > Change this to printing out the message once, per kernel boot.
>
> It doesn't do that. It prints it once every 2^32 calls. Also
I noted that as well. How about just using something along the lines of
static unsigned char printed_message = 0;
if (!printed_message) {
printk(...);
printed_message++;
}
--
Jesper Juhl <jesper.juhl@gmail.com>
Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please http://www.expita.com/nomime.html
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH] kill massive wireless-related log spam
2005-10-26 15:23 ` Jesper Juhl
@ 2005-10-26 21:23 ` J.A. Magallon
2005-10-26 21:43 ` Jesper Juhl
0 siblings, 1 reply; 7+ messages in thread
From: J.A. Magallon @ 2005-10-26 21:23 UTC (permalink / raw)
To: Linux-Kernel; +Cc: netdev
On 2005.10.26, at 17:23, Jesper Juhl wrote:
> On 10/26/05, Andi Kleen <ak@suse.de> wrote:
>
>> On Wednesday 26 October 2005 06:28, Jeff Garzik wrote:
>>
>>
>>> Change this to printing out the message once, per kernel boot.
>>>
>>
>> It doesn't do that. It prints it once every 2^32 calls. Also
>>
>
> I noted that as well. How about just using something along the
> lines of
>
> static unsigned char printed_message = 0;
> if (!printed_message) {
> printk(...);
> printed_message++;
> }
Sorry, but why not the old good
printed_message = 1
??
What kind of microoptimization is that ?
--
J.A. Magallon <jamagallon()able!es> \ Software is like sex:
wolverine \ It's better when it's free
MacOS X 10.4.2, Darwin Kernel Version 8.2.0
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH] kill massive wireless-related log spam
2005-10-26 21:23 ` J.A. Magallon
@ 2005-10-26 21:43 ` Jesper Juhl
0 siblings, 0 replies; 7+ messages in thread
From: Jesper Juhl @ 2005-10-26 21:43 UTC (permalink / raw)
To: J.A. Magallon; +Cc: Linux-Kernel, netdev
On 10/26/05, J.A. Magallon <jamagallon@able.es> wrote:
>
> On 2005.10.26, at 17:23, Jesper Juhl wrote:
>
> > On 10/26/05, Andi Kleen <ak@suse.de> wrote:
> >
> >> On Wednesday 26 October 2005 06:28, Jeff Garzik wrote:
> >>
> >>
> >>> Change this to printing out the message once, per kernel boot.
> >>>
> >>
> >> It doesn't do that. It prints it once every 2^32 calls. Also
> >>
> >
> > I noted that as well. How about just using something along the
> > lines of
> >
> > static unsigned char printed_message = 0;
> > if (!printed_message) {
> > printk(...);
> > printed_message++;
> > }
>
> Sorry, but why not the old good
>
> printed_message = 1
>
> ??
> What kind of microoptimization is that ?
>
Does it really matter? I needed to pick one of
printed_message=1; or printed_message++;
the end result is the same, so I just picked one at random.
But now that you mention it, I guess ++ would turn into "inc" which
should be faster than an assignment... but it *doesn't matter*... I
was not trying to optimize anything, just make the code work properly
- as in, only ever print the message once...
--
Jesper Juhl <jesper.juhl@gmail.com>
Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please http://www.expita.com/nomime.html
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] kill massive wireless-related log spam
2005-10-26 15:04 ` Andi Kleen
2005-10-26 15:23 ` Jesper Juhl
@ 2005-10-26 15:42 ` Jeff Garzik
2005-10-27 17:37 ` Horst von Brand
1 sibling, 1 reply; 7+ messages in thread
From: Jeff Garzik @ 2005-10-26 15:42 UTC (permalink / raw)
To: Andi Kleen; +Cc: Linus Torvalds, netdev, linux-kernel, jketreno, Andrew Morton
Andi Kleen wrote:
> On Wednesday 26 October 2005 06:28, Jeff Garzik wrote:
>
>
>>Change this to printing out the message once, per kernel boot.
>
>
> It doesn't do that. It prints it once every 2^32 calls. Also
...which is effectively one per kernel boot
> the ++ causes unnecessary dirty cache lines in normal operation.
Not a hot path operation by any stretch of the imagination, so that's fine.
Jeff
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] kill massive wireless-related log spam
2005-10-26 15:42 ` Jeff Garzik
@ 2005-10-27 17:37 ` Horst von Brand
0 siblings, 0 replies; 7+ messages in thread
From: Horst von Brand @ 2005-10-27 17:37 UTC (permalink / raw)
To: Jeff Garzik
Cc: Andi Kleen, Linus Torvalds, netdev, linux-kernel, jketreno,
Andrew Morton
Jeff Garzik <jgarzik@pobox.com> wrote:
> Andi Kleen wrote:
> > On Wednesday 26 October 2005 06:28, Jeff Garzik wrote:
> >
> >>Change this to printing out the message once, per kernel boot.
> > It doesn't do that. It prints it once every 2^32 calls. Also
>
> ...which is effectively one per kernel boot
>
>
> > the ++ causes unnecessary dirty cache lines in normal operation.
> Not a hot path operation by any stretch of the imagination, so that's
fine.
Right. As the "++" is inside "if(!printed) { ... }" it clearly isn't ;-)
--
Dr. Horst H. von Brand User #22616 counter.li.org
Departamento de Informatica Fono: +56 32 654431
Universidad Tecnica Federico Santa Maria +56 32 654239
Casilla 110-V, Valparaiso, Chile Fax: +56 32 797513
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2005-10-27 17:37 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-10-26 4:28 [PATCH] kill massive wireless-related log spam Jeff Garzik
2005-10-26 15:04 ` Andi Kleen
2005-10-26 15:23 ` Jesper Juhl
2005-10-26 21:23 ` J.A. Magallon
2005-10-26 21:43 ` Jesper Juhl
2005-10-26 15:42 ` Jeff Garzik
2005-10-27 17:37 ` Horst von Brand
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).