mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 02:30:34 +02:00 
			
		
		
		
	srcu: Simplify __srcu_read_unlock() via this_cpu_dec()
This commit replaces disabling of preemption and decrement of a per-CPU variable with this_cpu_dec(), which avoids preemption disabling on x86 and shortens the code on all platforms. Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com> Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
This commit is contained in:
		
							parent
							
								
									0351096eb0
								
							
						
					
					
						commit
						5a41344a3d
					
				
					 1 changed files with 1 additions and 3 deletions
				
			
		| 
						 | 
					@ -321,10 +321,8 @@ EXPORT_SYMBOL_GPL(__srcu_read_lock);
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void __srcu_read_unlock(struct srcu_struct *sp, int idx)
 | 
					void __srcu_read_unlock(struct srcu_struct *sp, int idx)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	preempt_disable();
 | 
					 | 
				
			||||||
	smp_mb(); /* C */  /* Avoid leaking the critical section. */
 | 
						smp_mb(); /* C */  /* Avoid leaking the critical section. */
 | 
				
			||||||
	ACCESS_ONCE(this_cpu_ptr(sp->per_cpu_ref)->c[idx]) -= 1;
 | 
						this_cpu_dec(sp->per_cpu_ref->c[idx]);
 | 
				
			||||||
	preempt_enable();
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
EXPORT_SYMBOL_GPL(__srcu_read_unlock);
 | 
					EXPORT_SYMBOL_GPL(__srcu_read_unlock);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue