Re: [PATCH 1/2] percpu_counter: Rename __percpu_counter_add to percpu_counter_add_batch

From: Tejun Heo
Date: Tue Jun 20 2017 - 13:28:46 EST


Hello, Nikolay.

On Tue, Jun 20, 2017 at 02:36:29PM +0300, Nikolay Borisov wrote:
> 252e0ba6b77d ("lib: percpu_counter variable batch") added a batched version
> of percpu_counter_add. However, one problem with this patch is the fact that it
> overloads the meaning of double underscore, which in kernel-land are taken
> to implicitly mean there is no preempt protection for the API. Currently, in

I don't think the above holds. We use __ for quite a few different
things. Sometimes it denotes internal functions which shouldn't be
used outside a subsystem, sometimes just more explicit / verbose
versions of certain operations, at other times less protection against
preemption / irq / whatever.

> both !SMP and SMP configs percpu_counter_add calls __percpu_counter_add which
> is preempt safe due to explicit calls to preempt_disable. This state of play
> creates the false sense that __percpu_counter_add is less SMP-safe than
> percpu_counter_add. They are both identical irrespective of CONFIG_SNMP value.
> The only difference is that the __ version takes a batch parameter.
>
> Make this a bit more explicit by just renaming __percpu_counter_add to
> percpu_counter_add_batch.

I'm all for making the function name more explicit, but can you please
drop the first part of the commit description?

Thanks.

--
tejun