tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: percpu_foreach() does not execute remotely



> Date: Tue, 28 Jan 2020 20:00:00 -0800
> From: Jason Thorpe <thorpej%me.com@localhost>
> 
> Hm, actually, I think you are right, but because of a property of
> xcalls themselves...
> 
> -- percpu_cpu_swap() is a low-pri xcall, and thus won't run
> concurrently with a low-pri percpu_foreach_xcall(), so no need to
> grab percpu_swap_lock, the way that the basic percpu_foreach() does.
> 
> -- And as stated before, percpu_cpu_swap()'s critical section is
> protected by splhigh(), which provides synchronization on the remote
> cpu with a high-pri percpu_foreach_xcall().
> 
> It warrants a comment, so I'll add one.

The reason percpu_foreach takes percpu_swap_lock is so that the
pointer percpu_getptr_remote returns remains stable _without_
percpu_getref/putref.

This isn't related to xcalls, priority, or splfoo -- it's just a
matter of using perpcu_getref/putref vs percpu_getptr_remote, the
latter of which must be bracketed by percpu_traverse_enter/exit.


Home | Main Index | Thread Index | Old Index