Re: [PATCH RFC] percpu: add data dependency barrier in percpu accessors and operations
From: Tejun Heo
Date: Tue Jun 17 2014 - 16:44:57 EST
Hello, Christoph.
On Tue, Jun 17, 2014 at 02:42:48PM -0500, Christoph Lameter wrote:
> > > I much prefer the model where the thing that -published- the pointer is
> > > responsible for memory ordering. After all, if a task allocates some
> > > zeroed memory, uses it locally, then frees it, there is no ordering
> > > to worry about in the first place. The memory allocator doing the
> > > initialization cannot tell how the memory is to be used, after all.
> >
> > Yeah, "publish" is a nice verb to put on it. No objection.
>
> Well that "publishing" of the structure that contains the per cpu offset
> is actually what most of the current code does. So we do not need any
> additional synchronization. Clarifying the responsibility for
> synchronization being with the code which does the alloc_percpu would be
> good.
Sure, we can declare that it follows the same rules as normal memory
allocations - that is, the zeroing belongs to the allocating cpu and
propagation is fully the responsbility of users including data dep
barrier when necessary.
It seems a lot more confusing to me than normal memory allocations
mostly because the ownership isn't immediately clear; however, it
could be that we just need to clarify.
I'll think more about it.
Thanks.
--
tejun
--
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/