History

tracing: Use swap macro in update_max_tr

Make use of the swap macro and remove unnecessary variable _buf_. This makes the code easier to read and maintain. Also, reduces the stack usage. This code was detected with the help of Coccinelle. Link: http://lkml.kernel.org/r/20180209175316.GA18720@embeddedgus

Gustavo A. R. Silva committed 8 years ago

Commit 08ae88f1 parent 1a63dcd1 file · +1 −5Browse files

Showing the changes to kernel (1 of 1 file). Show all

Unified · Split

kernel/trace/trace.c+1−5
@@ -1360,8 +1360,6 @@ __update_max_tr(struct trace_array *tr, struct task_struct *tsk, int cpu) · 1359 unmodified lines
1360void1360void
1361update_max_tr(struct trace_array *tr, struct task_struct *tsk, int cpu)1361update_max_tr(struct trace_array *tr, struct task_struct *tsk, int cpu)
1362{1362{
1363 struct ring_buffer *buf;
1364
1365 if (tr->stop_count)1363 if (tr->stop_count)
1366 return;1364 return;
1367 1365
@@ -1375,9 +1373,7 @@ update_max_tr(struct trace_array *tr, struct task_struct *tsk, int cpu) · 7 unmodified lines
1375 1373
1376 arch_spin_lock(&tr->max_lock);1374 arch_spin_lock(&tr->max_lock);
1377 1375
1378 buf = tr->trace_buffer.buffer;1376 swap(tr->trace_buffer.buffer, tr->max_buffer.buffer);
1379 tr->trace_buffer.buffer = tr->max_buffer.buffer;
1380 tr->max_buffer.buffer = buf;
1381 1377
1382 __update_max_tr(tr, tsk, cpu);1378 __update_max_tr(tr, tsk, cpu);
1383 arch_spin_unlock(&tr->max_lock);1379 arch_spin_unlock(&tr->max_lock);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t