On 09/24, Peter Zijlstra wrote: > > On Tue, Sep 24, 2013 at 08:00:05PM +0200, Oleg Nesterov wrote: > > > > Yes, we need to ensure gcc doesn't reorder this code so that > > do_something() comes before get_online_cpus(). But it can't? At least > > it should check current->cpuhp_ref != 0 first? And if it is non-zero > > we do not really care, we are already in the critical section and > > this ->cpuhp_ref has only meaning in put_online_cpus(). > > > > Confused... > > > So the reason I put it in was because of the inline; it could possibly > make it do: [...snip...] > In which case the recursive fast path doesn't have a barrier() between > taking the ref and starting do_something(). Yes, but my point was, this can only happen in recursive fast path. And in this case (I think) we do not care, we are already in the critical section. current->cpuhp_ref doesn't matter at all until we call put_online_cpus(). Suppose that gcc knows for sure that current->cpuhp_ref != 0. Then I think, for example, get_online_cpus(); do_something(); put_online_cpus(); converted to do_something(); current->cpuhp_ref++; current->cpuhp_ref--; is fine. do_something() should not depend on ->cpuhp_ref. OK, please forget. I guess I will never understand this ;) Oleg. -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxx. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>