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

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
13601360 void
13611361 update_max_tr(struct trace_array *tr, struct task_struct *tsk, int cpu)
13621362 {
1363− struct ring_buffer *buf;
1364−
13651363 if (tr->stop_count)
13661364 return;
13671365
@@ -1375,9 +1373,7 @@ update_max_tr(struct trace_array *tr, struct task_struct *tsk, int cpu) · 7 unmodified lines
13751373
13761374 arch_spin_lock(&tr->max_lock);
13771375
1378− buf = tr->trace_buffer.buffer;
1379− tr->trace_buffer.buffer = tr->max_buffer.buffer;
1380− tr->max_buffer.buffer = buf;
1376+ swap(tr->trace_buffer.buffer, tr->max_buffer.buffer);
13811377
13821378 __update_max_tr(tr, tsk, cpu);
13831379 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