Re: [profile] amortize atomic hit count increments

From: Andrew Morton
Date: Tue Sep 14 2004 - 01:55:36 EST


William Lee Irwin III <wli@xxxxxxxxxxxxxx> wrote:
>

A few comments which describe the design would be nice...

> +#ifdef CONFIG_SMP
> +static void __profile_flip_buffers(void *unused)
> +{
> + int cpu = get_cpu();
> + unsigned long flags;
> +
> + local_irq_save(flags);
> + per_cpu(cpu_profile_flip, cpu) = !per_cpu(cpu_profile_flip, cpu);
> + local_irq_restore(flags);
> + put_cpu();
> +}

hm. Does an IPI handler need to disable local IRQs?

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

Is this preempt-safe?

> + on_each_cpu(__profile_flip_buffers, NULL, 0, 1);
> + for_each_online_cpu(cpu) {
> + struct profile_hit *hits = per_cpu(cpu_profile_hits, cpu)[j];


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