rcu: Export debug_init_rcu_head() and and debug_init_rcu_head()
Currently, call_rcu() relies on implicit allocation and initialization for the debug-objects handling of RCU callbacks. If you hammer the kernel hard enough with Sasha's modified version of trinity, you can end up with the sl*b allocators recursing into themselves via this implicit call_rcu() allocation. This commit therefore exports the debug_init_rcu_head() and debug_rcu_head_free() functions, which permits the allocators to allocated and pre-initialize the debug-objects information, so that there no longer any need for call_rcu() to do that initialization, which in turn prevents the recursion into the memory allocators. Reported-by: Sasha Levin <sasha.levin@oracle.com> Suggested-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Acked-by: Thomas Gleixner <tglx@linutronix.de> Looks-good-to: Christoph Lameter <cl@linux.com>
This commit is contained in:
		
					parent
					
						
							
								7171511eae
							
						
					
				
			
			
				commit
				
					
						546a9d8519
					
				
			
		
					 2 changed files with 12 additions and 2 deletions
				
			
		| 
						 | 
					@ -358,9 +358,19 @@ void wait_rcu_gp(call_rcu_func_t crf);
 | 
				
			||||||
 * initialization.
 | 
					 * initialization.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
#ifdef CONFIG_DEBUG_OBJECTS_RCU_HEAD
 | 
					#ifdef CONFIG_DEBUG_OBJECTS_RCU_HEAD
 | 
				
			||||||
 | 
					void init_rcu_head(struct rcu_head *head);
 | 
				
			||||||
 | 
					void destroy_rcu_head(struct rcu_head *head);
 | 
				
			||||||
void init_rcu_head_on_stack(struct rcu_head *head);
 | 
					void init_rcu_head_on_stack(struct rcu_head *head);
 | 
				
			||||||
void destroy_rcu_head_on_stack(struct rcu_head *head);
 | 
					void destroy_rcu_head_on_stack(struct rcu_head *head);
 | 
				
			||||||
#else /* !CONFIG_DEBUG_OBJECTS_RCU_HEAD */
 | 
					#else /* !CONFIG_DEBUG_OBJECTS_RCU_HEAD */
 | 
				
			||||||
 | 
					static inline void init_rcu_head(struct rcu_head *head)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static inline void destroy_rcu_head(struct rcu_head *head)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static inline void init_rcu_head_on_stack(struct rcu_head *head)
 | 
					static inline void init_rcu_head_on_stack(struct rcu_head *head)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -200,12 +200,12 @@ void wait_rcu_gp(call_rcu_func_t crf)
 | 
				
			||||||
EXPORT_SYMBOL_GPL(wait_rcu_gp);
 | 
					EXPORT_SYMBOL_GPL(wait_rcu_gp);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef CONFIG_DEBUG_OBJECTS_RCU_HEAD
 | 
					#ifdef CONFIG_DEBUG_OBJECTS_RCU_HEAD
 | 
				
			||||||
static inline void debug_init_rcu_head(struct rcu_head *head)
 | 
					void init_rcu_head(struct rcu_head *head)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	debug_object_init(head, &rcuhead_debug_descr);
 | 
						debug_object_init(head, &rcuhead_debug_descr);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static inline void debug_rcu_head_free(struct rcu_head *head)
 | 
					void destroy_rcu_head(struct rcu_head *head)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	debug_object_free(head, &rcuhead_debug_descr);
 | 
						debug_object_free(head, &rcuhead_debug_descr);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue