Re: [PATCH 1/3] rcu: Use static initializer for krc.lock

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

 



On Thu, Apr 16, 2020 at 03:24:00PM -0400, Steven Rostedt wrote:
> On Thu, 16 Apr 2020 14:53:12 -0400
> Joel Fernandes <joel@xxxxxxxxxxxxxxxxx> wrote:
> 
> > > static inline this_cpu_spin_lock_irqsave(struct spinlock __per_cpu *lock)
> > > {
> > > 	migrate_disable();
> > > 	spin_lock_irqsave(this_cpu_ptr(lock));
> > > 	migrate_enable();
> > > }  
> > 
> > Here we want to grab the pointer of a per-CPU structure for the local CPU,
> > and then grab its lock at the same time without getting migrated, so at least
> > for this code the above API, it may not fit properly but perhaps for other
> > code it may.
> 
> 	this_cpu_spin_lock_irqsave(&krc.lock);
> 	krcp = this_cpu_ptr(&krc);

Apologies, I forgot that its perfectly Ok to access per CPU oject's
elements this way without first grabbing the per CPU object's base pointer.
All that matters is the offset within the object is biased to whichever CPU's
per-cpu area.

It could be called this_cpu_raw_spin_lock_irqsave() if we don't want it to
grab rtmutex on -rt :-)

> Note, spin_lock() disables migration, even on PREEMPT_RT.

Makes sense.

thanks,

 - Joel





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux