Re: [profile] fix timer interrupt livelock on 512x Altix

From: Rusty Russell
Date: Thu Oct 14 2004 - 20:48:04 EST


On Tue, 2004-09-21 at 07:30, William Lee Irwin III wrote:
> +static void __profile_flip_buffers(void *unused)
> +{
> + int cpu = smp_processor_id();
> +
> + per_cpu(cpu_profile_flip, cpu) = !per_cpu(cpu_profile_flip, cpu);
> +}

Please: one point of per-cpu vars is that archs can choose to hold the
per-cpu offset in a reg, and derive smp_processor_id() from that. By
doing the reverse, manually, you defeat this. How about:

int *flip = __get_cpu_var(cpu_profile_flip);
*flip = !*flip;

> +
> +static void profile_flip_buffers(void)
> +{
> + int i, j, cpu;
> +
> + down(&profile_flip_mutex);
> + j = per_cpu(cpu_profile_flip, get_cpu());
> + put_cpu();

Similarly, this is equivalent to:
j = __get_cpu_var(cpu_profile_flip);

Cheers,
Rusty.
--
Anyone who quotes me in their signature is an idiot -- Rusty Russell

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