kill massive wireless-related log spam
Subsystems (2)
PATCH 1/1 kill massive wireless-related log spam
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.
net/core/wireless.c +7 -2
@@ -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 ; }
Quoted 1 line · Jeff Garzik
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
Quoted 20 lines
net/core/wireless.c +7
-2@@ -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); } +
Quoted 5 lines · Andi Kleen
Quoted 1 line · Jeff Garzik
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 <[email protected]>
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
Quoted 11 lines · Jesper Juhl
Quoted 8 lines · Andi Kleen
Quoted 2 lines · Jeff Garzik
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
Quoted 7 lines
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
Quoted 23 lines · J.A. Magallon
Quoted 11 lines · Jesper Juhl
Quoted 8 lines · Andi Kleen
Quoted 2 lines · Jeff Garzik
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
Quoted 8 lines
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++; }
Quoted 7 lines
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 <[email protected]>
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
Quoted 7 lines · Andi Kleen
Quoted 1 line · Jeff Garzik
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
Quoted 1 line
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
Quoted 4 lines · Jeff Garzik
Quoted 3 lines · Andi Kleen
Quoted 1 line · Jeff Garzik
Change this to printing out the message once, per kernel boot.
Quoted 8 lines
Quoted 1 line
It doesn't do that. It prints it once every 2^32 calls. Also
...which is effectively one per kernel boot
Quoted 1 line
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 ;-)
Signature · 4 lines
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