Re: mmotm 2009-04-10-02-21 uploaded - forkbombed by work_for_cpu

From: Andrew Morton
Date: Wed Apr 15 2009 - 04:42:22 EST


On Wed, 15 Apr 2009 12:45:34 +0430 Ali Gholami Rudi <ali@xxxxxxx> wrote:

> Hi,
>
> In today's tip (v2.6.30-rc2), when my cpu is idle (and the ondemand
> governor correctly uses the lowest frequency) the temperature of my CPU
> rises to above 50^C till the fan turns on (it used to be about 40^C
> before). Git bisect points to this patch:
>
> commit 01599fca6758d2cd133e78f87426fc851c9ea725
> Author: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
> Date: Mon Apr 13 10:27:49 2009 -0700
>
> cpufreq: use smp_call_function_[single|many]() in acpi-cpufreq.c
>
> Atttempting to rid us of the problematic work_on_cpu(). Just use
> smp_call_fuction_single() here.
>
> This repairs a 10% sysbench(oltp)+mysql regression which Mike reported,
> due to
>
> commit 6b44003e5ca66a3fffeb5bc90f40ada2c4340896
> Author: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
> Date: Thu Apr 9 09:50:37 2009 -0600
>
> work_on_cpu(): rewrite it to create a kernel thread on demand
>
> It seems that the kernel calls these acpi-cpufreq functions at a quite
> high frequency.
>
> Valdis Kletnieks also reports that this causes 70-90 forks per second on
> his hardware.
>
> Cc: Valdis.Kletnieks@xxxxxx
> Cc: Rusty Russell <rusty@xxxxxxxxxxxxxxx>
> Cc: Venkatesh Pallipadi <venkatesh.pallipadi@xxxxxxxxx>
> Cc: Len Brown <len.brown@xxxxxxxxx>
> Cc: Zhao Yakui <yakui.zhao@xxxxxxxxx>
> Acked-by: Dave Jones <davej@xxxxxxxxxx>
> Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
> Tested-by: Mike Galbraith <efault@xxxxxx>
> Cc: "Zhang, Yanmin" <yanmin_zhang@xxxxxxxxxxxxxxx>
> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
> Acked-by: Ingo Molnar <mingo@xxxxxxx>
> [ Made it use smp_call_function_many() instead of looping over cpu's
> with smp_call_function_single() - Linus ]

<stares suspiciously at smp_call_function_many()>

* smp_call_function_many(): Run a function on a set of other CPUs.

"other". It refuses to call the function on *this* CPU. Tricky.

Does this fix it up?

--- a/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c~a
+++ a/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c
@@ -204,7 +204,10 @@ static void drv_read(struct drv_cmd *cmd

static void drv_write(struct drv_cmd *cmd)
{
- smp_call_function_many(cmd->mask, do_drv_write, cmd, 1);
+ unsigned cpu;
+
+ for_each_cpu(cpu, cmd->mask)
+ smp_call_function_single(cpu, do_drv_write, cmd, 1);
}

static u32 get_cur_val(const struct cpumask *mask)
_

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/