* driver or calculation of load average wrong ?
@ 2010-10-11 6:24 Frank Salomon
2010-10-11 7:40 ` Alexander Clouter
2010-10-11 19:39 ` Greg KH
0 siblings, 2 replies; 4+ messages in thread
From: Frank Salomon @ 2010-10-11 6:24 UTC (permalink / raw)
To: linux-kernel
Hello All,
I have the following configuration:
- CentOS 5
- kernel 2.6.20.1
- My own driver in a kernel_thread:
while ( 1 ){
printk ( KERN_INFO "go sleep, %lu\n", jiffies );
current -> state = TASK_UNINTERRUPTIBLE;
schedule_timeout ( msecs_to_jiffies(4000) );
printk ( KERN_INFO "wakeup, %lu\n", jiffies );
}
Each time I load the driver, the load average in /proc/loadavg reached:
$ cat /proc/loadavg
0.99 0.62 0.26 1/47 2868
Without my driver:
$ cat /proc/loadavg
0.03 0.03 0.00 1/47 2867
I changed nr_active(void) in kernel/sched.c:
unsigned long nr_active(void)
{
unsigned long i, running = 0, uninterruptible = 0;
for_each_online_cpu(i) {
running += cpu_rq(i)->nr_running;
uninterruptible += cpu_rq(i)->nr_uninterruptible;
}
if (unlikely((long)uninterruptible < 0))
uninterruptible = 0;
// original: return running + uninterruptible;
return running;
}
Driver loaded or not:
$ cat /proc/loadavg
0.03 0.03 0.00 1/47 2867
Any help or comments would be really great?
Best regards, thanks, Frank
--
WINCOR NIXDORF International GmbH
Retail Store Solutions
Heinz-Nixdorf-Ring 1
33106 Paderborn
Tel. +49 (0) 30 5017 1335
Fax +49 (0) 30 5017 1305
mail frank.salomon@wincor-nixdorf.com
WINCOR NIXDORF International GmbH
Sitz der Gesellschaft: Paderborn
Registergericht Paderborn HRB 3507
Geschäftsführer: Eckard Heidloff (Vorsitzender), Stefan Auerbach, Dr. Jürgen Wunram
Vorsitzender des Aufsichtsrats: Karl-Heinz Stiller
Steuernummer: 339/5884/0020 - Ust-ID Nr.: DE812927716 - WEEE-Reg.-Nr. DE44477193
Diese E-Mail enthält vertrauliche Informationen.
Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben,
informieren Sie bitte sofort den Absender und vernichten Sie diese E-Mail.
Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser E-Mail ist nicht gestattet.
This e-mail may contain confidential information.
If you are not the intended recipient (or have received this e-mail in error)
please notify the sender immediately and destroy this e-mail.
Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden.
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: driver or calculation of load average wrong ?
2010-10-11 6:24 driver or calculation of load average wrong ? Frank Salomon
@ 2010-10-11 7:40 ` Alexander Clouter
2010-10-11 19:39 ` Greg KH
1 sibling, 0 replies; 4+ messages in thread
From: Alexander Clouter @ 2010-10-11 7:40 UTC (permalink / raw)
To: linux-kernel
Frank Salomon <frank.salomon@wincor-nixdorf.com> wrote:
>
> I have the following configuration:
> - CentOS 5
> - kernel 2.6.20.1
> - My own driver in a kernel_thread:
>
> [snipped NDA'd information]
>
> Any help or comments would be really great?
>
> Best regards, thanks, Frank
> --
> WINCOR NIXDORF International GmbH
> Retail Store Solutions
> Heinz-Nixdorf-Ring 1
> 33106 Paderborn
> Tel. +49 (0) 30 5017 1335
> Fax +49 (0) 30 5017 1305
> mail frank.salomon@wincor-nixdorf.com
>
> WINCOR NIXDORF International GmbH
> Sitz der Gesellschaft: Paderborn
> Registergericht Paderborn HRB 3507
> Geschäftsführer: Eckard Heidloff (Vorsitzender), Stefan Auerbach, Dr. Jürgen Wunram
> Vorsitzender des Aufsichtsrats: Karl-Heinz Stiller
> Steuernummer: 339/5884/0020 - Ust-ID Nr.: DE812927716 - WEEE-Reg.-Nr. DE44477193
>
> Diese E-Mail enthält vertrauliche Informationen.
> Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben,
> informieren Sie bitte sofort den Absender und vernichten Sie diese E-Mail.
> Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser E-Mail ist nicht gestattet.
>
> This e-mail may contain confidential information.
> If you are not the intended recipient (or have received this e-mail in error)
> please notify the sender immediately and destroy this e-mail.
> Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden.
>
...alas I have to consult with my lawyer before being able to help.
Cheers
--
Alexander Clouter
.sigmonster says: BOFH excuse #153:
Big to little endian conversion error
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: driver or calculation of load average wrong ?
2010-10-11 6:24 driver or calculation of load average wrong ? Frank Salomon
2010-10-11 7:40 ` Alexander Clouter
@ 2010-10-11 19:39 ` Greg KH
1 sibling, 0 replies; 4+ messages in thread
From: Greg KH @ 2010-10-11 19:39 UTC (permalink / raw)
To: Frank Salomon; +Cc: linux-kernel
On Mon, Oct 11, 2010 at 08:24:49AM +0200, Frank Salomon wrote:
> Hello All,
>
> I have the following configuration:
> - CentOS 5
> - kernel 2.6.20.1
> - My own driver in a kernel_thread:
> while ( 1 ){
> printk ( KERN_INFO "go sleep, %lu\n", jiffies );
> current -> state = TASK_UNINTERRUPTIBLE;
> schedule_timeout ( msecs_to_jiffies(4000) );
Change this to schedule_timeout_interruptable() and your load average
calculation will go back to what you expect it to.
hope this helps,
greg k-h
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] dma/timberdale: simplify conditional
@ 2010-10-07 22:48 Nicolas Kaiser
2010-10-08 12:22 ` Jack Stone
0 siblings, 1 reply; 4+ messages in thread
From: Nicolas Kaiser @ 2010-10-07 22:48 UTC (permalink / raw)
To: Dan Williams; +Cc: linux-kernel
Simplify: ((a && b) || (!a && !b)) => (a == b)
Signed-off-by: Nicolas Kaiser <nikai@nikai.net>
---
drivers/dma/timb_dma.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/dma/timb_dma.c b/drivers/dma/timb_dma.c
index 2ec1ed5..3b88a4e 100644
--- a/drivers/dma/timb_dma.c
+++ b/drivers/dma/timb_dma.c
@@ -759,7 +759,7 @@ static int __devinit td_probe(struct platform_device *pdev)
pdata->channels + i;
/* even channels are RX, odd are TX */
- if (((i % 2) && pchan->rx) || (!(i % 2) && !pchan->rx)) {
+ if ((i % 2) == pchan->rx) {
dev_err(&pdev->dev, "Wrong channel configuration\n");
err = -EINVAL;
goto err_tasklet_kill;
--
1.7.2.2
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] dma/timberdale: simplify conditional
2010-10-07 22:48 [PATCH] dma/timberdale: simplify conditional Nicolas Kaiser
@ 2010-10-08 12:22 ` Jack Stone
2010-10-08 12:25 ` Jack Stone
0 siblings, 1 reply; 4+ messages in thread
From: Jack Stone @ 2010-10-08 12:22 UTC (permalink / raw)
To: Nicolas Kaiser, Dan Williams; +Cc: linux-kernel, torvalds, akpm
We should be careful with this sort of transformation. It is only
guaranteed true if both sides are boolean. E.g. ((foo & mask) && (bar &
baz)) ¦¦ (!(foo & mask) && (!(bar & baz)) does not imply (foo & mask) ==
(bar & baz)). foo & mask could equal 0x0100 for example but bar & baz
could equal 0x0001. Both are true as logicals but they are not equal.
One safe way to make this patch would be to add !! in front of both
halves.
Of course this is a moot point if pdes->rx is a boolean or a single bit
but I don't have the source to hand to check this (% 2 is guaranteed to
be 0 or 1 so it doesn't matter).
Sorry if this doesn't make sense. Let me know and I can try and
rephrase.
Hope this helps,
Jack
On Fri, 08 Oct 2010 00:48 +0200, "Nicolas Kaiser" <nikai@nikai.net>
wrote:
> Simplify: ((a && b) || (!a && !b)) => (a == b)
>
> Signed-off-by: Nicolas Kaiser <nikai@nikai.net>
> ---
> drivers/dma/timb_dma.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/dma/timb_dma.c b/drivers/dma/timb_dma.c
> index 2ec1ed5..3b88a4e 100644
> --- a/drivers/dma/timb_dma.c
> +++ b/drivers/dma/timb_dma.c
> @@ -759,7 +759,7 @@ static int __devinit td_probe(struct platform_device
> *pdev)
> pdata->channels + i;
>
> /* even channels are RX, odd are TX */
> - if (((i % 2) && pchan->rx) || (!(i % 2) && !pchan->rx)) {
> + if ((i % 2) == pchan->rx) {
> dev_err(&pdev->dev, "Wrong channel configuration\n");
> err = -EINVAL;
> goto err_tasklet_kill;
> --
> 1.7.2.2
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel"
> in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] dma/timberdale: simplify conditional
2010-10-08 12:22 ` Jack Stone
@ 2010-10-08 12:25 ` Jack Stone
2010-10-08 12:48 ` driver or calculation of load average wrong ? Frank Salomon
0 siblings, 1 reply; 4+ messages in thread
From: Jack Stone @ 2010-10-08 12:25 UTC (permalink / raw)
To: Nicolas Kaiser, Dan Williams; +Cc: linux-kernel, torvalds, akpm
My sincere apologies for the previous mail and the HTML email. I am
still trying to get used to a new mail client but it is no excuse.
Sorry,
Jack
^ permalink raw reply [flat|nested] 4+ messages in thread
* driver or calculation of load average wrong ?
2010-10-08 12:25 ` Jack Stone
@ 2010-10-08 12:48 ` Frank Salomon
0 siblings, 0 replies; 4+ messages in thread
From: Frank Salomon @ 2010-10-08 12:48 UTC (permalink / raw)
To: linux-kernel@vger.kernel.org
Hello All,
I have the following configuration:
- CentOS 5
- kernel 2.6.20.1
- My own driver in a kernel_thread:
while ( 1 ){
printk ( KERN_INFO "go sleep, %lu\n", jiffies );
current -> state = TASK_UNINTERRUPTIBLE;
schedule_timeout ( msecs_to_jiffies(4000) );
printk ( KERN_INFO "wakeup, %lu\n", jiffies );
}
Each time I load the driver, the load average in /proc/loadavg reached:
$ cat /proc/loadavg
0.99 0.62 0.26 1/47 2868
Without my driver:
$ cat /proc/loadavg
0.03 0.03 0.00 1/47 2867
I changed nr_active(void) in kernel/sched.c:
unsigned long nr_active(void)
{
unsigned long i, running = 0, uninterruptible = 0;
for_each_online_cpu(i) {
running += cpu_rq(i)->nr_running;
uninterruptible += cpu_rq(i)->nr_uninterruptible;
}
if (unlikely((long)uninterruptible < 0))
uninterruptible = 0;
// original: return running + uninterruptible;
return running;
}
Driver loaded or not:
$ cat /proc/loadavg
0.03 0.03 0.00 1/47 2867
Any help or comments would be really great?
Best regards, thanks, Frank
WINCOR NIXDORF International GmbH
Sitz der Gesellschaft: Paderborn
Registergericht Paderborn HRB 3507
Geschäftsführer: Eckard Heidloff (Vorsitzender), Stefan Auerbach, Dr. Jürgen Wunram
Vorsitzender des Aufsichtsrats: Karl-Heinz Stiller
Steuernummer: 339/5884/0020 - Ust-ID Nr.: DE812927716 - WEEE-Reg.-Nr. DE44477193
Diese E-Mail enthält vertrauliche Informationen.
Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben,
informieren Sie bitte sofort den Absender und vernichten Sie diese E-Mail.
Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser E-Mail ist nicht gestattet.
This e-mail may contain confidential information.
If you are not the intended recipient (or have received this e-mail in error)
please notify the sender immediately and destroy this e-mail.
Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-10-11 19:40 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-11 6:24 driver or calculation of load average wrong ? Frank Salomon
2010-10-11 7:40 ` Alexander Clouter
2010-10-11 19:39 ` Greg KH
-- strict thread matches above, loose matches on Subject: below --
2010-10-07 22:48 [PATCH] dma/timberdale: simplify conditional Nicolas Kaiser
2010-10-08 12:22 ` Jack Stone
2010-10-08 12:25 ` Jack Stone
2010-10-08 12:48 ` driver or calculation of load average wrong ? Frank Salomon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox