lkml.org 
[lkml]   [2004]   [Sep]   [14]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
DateMon, 13 Sep 2004 23:52:25 -0700
FromAndrew Morton <>
SubjectRe: [profile] amortize atomic hit count increments
William Lee Irwin III <wli@holomorphy.com> 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@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 14:06    [from the cache]
©2003-2008