Messages in this thread | | | Date | Wed, 20 May 2020 14:44:25 -0400 | From | Joel Fernandes <> | Subject | Re: [PATCH 3/8] srcu: Use local_lock() for per-CPU struct srcu_data access |
| |
On Wed, May 20, 2020 at 08:35:29PM +0200, Peter Zijlstra wrote: > On Wed, May 20, 2020 at 08:28:00PM +0200, Sebastian Andrzej Siewior wrote: > > On 2020-05-20 13:42:59 [-0400], Joel Fernandes wrote: > > > Hi Sebastian, > > Hi Joel, > > > > > For pointer stability, can we just use get_local_ptr() and put_local_ptr() > > > instead of adding an extra lock? This keeps the pointer stable while keeping > > > the section preemptible on -rt. And we already have a lock in rcu_data, I > > > prefer not to add another lock if possible. > > > > What is this get_local_ptr() doing? I can't find it anywhere… > > I suspect it is ({ preempt_disable(); this_cpu_ptr(ptr); }), or > something along those lines. > > But yeah, I can't find it either.
I actually found it in RT 4.4 kernel, I thought this was also on newer RT kernels as well (is that not true anymore?). But yes it was exactly what Peter said.
In 4.4 RT there's code similar to:
#ifdef CONFIG_PREEMPT_RT_FULL
# define get_local_ptr(var) ({ \ migrate_disable(); \ this_cpu_ptr(var); })
# define put_local_ptr(var) do { \ (void)(var); \ migrate_enable(); \ } while (0)
#else
#define get_local_ptr(var) get_cpu_ptr(var) #define put_local_ptr(var) put_cpu_ptr(var)
#endif
thanks,
- Joel
| |