aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace/trace.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/trace/trace.c')
-rw-r--r--kernel/trace/trace.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 1855dae73f34..22a902e2ded9 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -1441,12 +1441,12 @@ static void tracing_stop_tr(struct trace_array *tr)
1441 1441
1442void trace_stop_cmdline_recording(void); 1442void trace_stop_cmdline_recording(void);
1443 1443
1444static void trace_save_cmdline(struct task_struct *tsk) 1444static int trace_save_cmdline(struct task_struct *tsk)
1445{ 1445{
1446 unsigned pid, idx; 1446 unsigned pid, idx;
1447 1447
1448 if (!tsk->pid || unlikely(tsk->pid > PID_MAX_DEFAULT)) 1448 if (!tsk->pid || unlikely(tsk->pid > PID_MAX_DEFAULT))
1449 return; 1449 return 0;
1450 1450
1451 /* 1451 /*
1452 * It's not the end of the world if we don't get 1452 * It's not the end of the world if we don't get
@@ -1455,7 +1455,7 @@ static void trace_save_cmdline(struct task_struct *tsk)
1455 * so if we miss here, then better luck next time. 1455 * so if we miss here, then better luck next time.
1456 */ 1456 */
1457 if (!arch_spin_trylock(&trace_cmdline_lock)) 1457 if (!arch_spin_trylock(&trace_cmdline_lock))
1458 return; 1458 return 0;
1459 1459
1460 idx = map_pid_to_cmdline[tsk->pid]; 1460 idx = map_pid_to_cmdline[tsk->pid];
1461 if (idx == NO_CMDLINE_MAP) { 1461 if (idx == NO_CMDLINE_MAP) {
@@ -1480,6 +1480,8 @@ static void trace_save_cmdline(struct task_struct *tsk)
1480 memcpy(&saved_cmdlines[idx], tsk->comm, TASK_COMM_LEN); 1480 memcpy(&saved_cmdlines[idx], tsk->comm, TASK_COMM_LEN);
1481 1481
1482 arch_spin_unlock(&trace_cmdline_lock); 1482 arch_spin_unlock(&trace_cmdline_lock);
1483
1484 return 1;
1483} 1485}
1484 1486
1485void trace_find_cmdline(int pid, char comm[]) 1487void trace_find_cmdline(int pid, char comm[])
@@ -1521,9 +1523,8 @@ void tracing_record_cmdline(struct task_struct *tsk)
1521 if (!__this_cpu_read(trace_cmdline_save)) 1523 if (!__this_cpu_read(trace_cmdline_save))
1522 return; 1524 return;
1523 1525
1524 __this_cpu_write(trace_cmdline_save, false); 1526 if (trace_save_cmdline(tsk))
1525 1527 __this_cpu_write(trace_cmdline_save, false);
1526 trace_save_cmdline(tsk);
1527} 1528}
1528 1529
1529void 1530void