Re: [PATCH 3/3] kref: Remove the memory barriers

From: Peter Zijlstra
Date: Mon Dec 12 2011 - 05:13:22 EST


On Mon, 2011-12-12 at 17:57 +0800, Ming Lei wrote:
> On Mon, Dec 12, 2011 at 4:54 PM, Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
> > On Mon, 2011-12-12 at 11:48 +0800, Ming Lei wrote:
> >> For kref, maybe it is still multiple operations done on one cpu vs them
> >> being visible on another, but seems a bit implicit, see the common kref
> >> usage below:
> >>
> >> CPU0 CPU1
> >> A:kref_init(&obj->ref)
> >
> > how does CPU0 get a ref to obj?
>
> Suppose open/close/read/.. context is run on CPU0, and driver .probe/.release
> context(hotplug context) is run on CPU1. There are a few examples on
> usb driver(eg. usb-skeleton.c, ...)

I don't know the driver model, and I don't plan to start learning it
now. But if what you said is possible its broken and no memory barriers
will fix it.
--
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/