Re: [PATCH] percpu_counter: change inaccurate comment

From: Christoph Lameter
Date: Thu Oct 07 2010 - 17:06:17 EST


On Thu, 7 Oct 2010, Eric Dumazet wrote:

> >
> > The only difference between __this_cpu_ptr and this_cpu_ptr is that
> > this_cpu_ptr checks that preempt was disabled. __this_cpu_ptr allows use
> > even without preempt. Preempt must be disabled here so the use of
> > this_cpu_ptr is appropriate.
> >
> >
>
> Thats not how I read the thing.
>
> In both variants, preemption _must_ be disabled, its only the context
> that can tell how sure we are...

Correct. One checks the other one does not check.

> <quote>
>
> commit 7340a0b15280c
>
> __this_cpu_ptr -> Do not check for preemption context
> this_cpu_ptr -> Check preemption context
>
> </quote>
>
> If preemption was enabled, both pointers would not be very useful...
>
> We use __this_cpu_ptr() in contexts where cpu _cannot_ change under us,
> (we just disabled preemption one line above), so its not necessary to
> perform the check.

Someone could screw up the code in the future. Thats what its there for.


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