diff options
Diffstat (limited to 'kernel/trace/trace_functions_graph.c')
| -rw-r--r-- | kernel/trace/trace_functions_graph.c | 15 | 
1 files changed, 9 insertions, 6 deletions
diff --git a/kernel/trace/trace_functions_graph.c b/kernel/trace/trace_functions_graph.c index 2d25ad1526bb..a51e79688455 100644 --- a/kernel/trace/trace_functions_graph.c +++ b/kernel/trace/trace_functions_graph.c @@ -6,7 +6,6 @@   * is Copyright (c) Steven Rostedt <[email protected]>   *   */ -#include <linux/debugfs.h>  #include <linux/uaccess.h>  #include <linux/ftrace.h>  #include <linux/slab.h> @@ -151,7 +150,7 @@ ftrace_push_return_trace(unsigned long ret, unsigned long func, int *depth,  	 * The curr_ret_stack is initialized to -1 and get increased  	 * in this function.  So it can be less than -1 only if it was  	 * filtered out via ftrace_graph_notrace_addr() which can be -	 * set from set_graph_notrace file in debugfs by user. +	 * set from set_graph_notrace file in tracefs by user.  	 */  	if (current->curr_ret_stack < -1)  		return -EBUSY; @@ -1309,15 +1308,19 @@ void graph_trace_open(struct trace_iterator *iter)  {  	/* pid and depth on the last trace processed */  	struct fgraph_data *data; +	gfp_t gfpflags;  	int cpu;  	iter->private = NULL; -	data = kzalloc(sizeof(*data), GFP_KERNEL); +	/* We can be called in atomic context via ftrace_dump() */ +	gfpflags = (in_atomic() || irqs_disabled()) ? GFP_ATOMIC : GFP_KERNEL; + +	data = kzalloc(sizeof(*data), gfpflags);  	if (!data)  		goto out_err; -	data->cpu_data = alloc_percpu(struct fgraph_cpu_data); +	data->cpu_data = alloc_percpu_gfp(struct fgraph_cpu_data, gfpflags);  	if (!data->cpu_data)  		goto out_err_free; @@ -1432,7 +1435,7 @@ static const struct file_operations graph_depth_fops = {  	.llseek		= generic_file_llseek,  }; -static __init int init_graph_debugfs(void) +static __init int init_graph_tracefs(void)  {  	struct dentry *d_tracer; @@ -1445,7 +1448,7 @@ static __init int init_graph_debugfs(void)  	return 0;  } -fs_initcall(init_graph_debugfs); +fs_initcall(init_graph_tracefs);  static __init int init_graph_trace(void)  {  |