Re: [PATCH] Reduce cacheline bouncing in cpu_idle_wait

From: Andi Kleen
Date: Thu Mar 10 2005 - 03:54:31 EST


Zwane Mwaikambo <zwane@xxxxxxxxxxxxxxxx> writes:

> Andi noted that during normal runtime cpu_idle_map is bounced around a
> lot, and occassionally at a higher frequency than the timer interrupt
> wakeup which we normally exit pm_idle from. So switch to a percpu
> variable. Andi i didn't move things to the slow path because it would
> involve adding scheduler code to wakeup the idle thread on the cpus we're
> waiting for.

Thanks.
>
> -
> void cpu_idle_wait(void)
> {
> - int cpu;
> - cpumask_t map;
> + unsigned int cpu, this_cpu = get_cpu();
> + cpumask_t map;
> +
> + set_cpus_allowed(current, cpumask_of_cpu(this_cpu));
> + put_cpu();

You need a cpus_clear(map); here I think (probably same for the other
archs)

> +
> + for_each_online_cpu(cpu) {
> + per_cpu(cpu_idle_state, cpu) = 1;
> + cpu_set(cpu, map);
> + }



-Andi
-
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/