mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	sysctl,rcu: Convert call_rcu(free_head) to kfree
The RCU callback free_head just calls kfree(), so we can use kfree_rcu() instead of call_rcu(). Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Cc: Andrew Morton <akpm@linux-foundation.org> Reviewed-by: Josh Triplett <josh@joshtriplett.org>
This commit is contained in:
		
							parent
							
								
									22a3c7d188
								
							
						
					
					
						commit
						a95cded32d
					
				
					 1 changed files with 3 additions and 8 deletions
				
			
		| 
						 | 
					@ -1590,16 +1590,11 @@ void sysctl_head_get(struct ctl_table_header *head)
 | 
				
			||||||
	spin_unlock(&sysctl_lock);
 | 
						spin_unlock(&sysctl_lock);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void free_head(struct rcu_head *rcu)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	kfree(container_of(rcu, struct ctl_table_header, rcu));
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void sysctl_head_put(struct ctl_table_header *head)
 | 
					void sysctl_head_put(struct ctl_table_header *head)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	spin_lock(&sysctl_lock);
 | 
						spin_lock(&sysctl_lock);
 | 
				
			||||||
	if (!--head->count)
 | 
						if (!--head->count)
 | 
				
			||||||
		call_rcu(&head->rcu, free_head);
 | 
							kfree_rcu(head, rcu);
 | 
				
			||||||
	spin_unlock(&sysctl_lock);
 | 
						spin_unlock(&sysctl_lock);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1971,10 +1966,10 @@ void unregister_sysctl_table(struct ctl_table_header * header)
 | 
				
			||||||
	start_unregistering(header);
 | 
						start_unregistering(header);
 | 
				
			||||||
	if (!--header->parent->count) {
 | 
						if (!--header->parent->count) {
 | 
				
			||||||
		WARN_ON(1);
 | 
							WARN_ON(1);
 | 
				
			||||||
		call_rcu(&header->parent->rcu, free_head);
 | 
							kfree_rcu(header->parent, rcu);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if (!--header->count)
 | 
						if (!--header->count)
 | 
				
			||||||
		call_rcu(&header->rcu, free_head);
 | 
							kfree_rcu(header, rcu);
 | 
				
			||||||
	spin_unlock(&sysctl_lock);
 | 
						spin_unlock(&sysctl_lock);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue