History

refperf: Dynamically allocate thread-summary output buffer

Currently, the buffer used to accumulate the thread-summary output is fixed size, which will cause problems if someone decides to run on a large number of PCUs. This commit therefore dynamically allocates this buffer. [ paulmck: Fix memory allocation as suggested by KASAN. ] Cc: Joel Fernandes (Google) <joel@joelfernandes.org> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>

Paul E. McKenney committed 6 years ago

Commit 2e90de71 parent f518f151 file · +5 −1Browse files

Unified · Split

kernel/rcu/refperf.c+5−1
@@ -301,9 +301,12 @@ u64 process_durations(int n) · 300 unmodified lines
301 int i;301 int i;
302 struct reader_task *rt;302 struct reader_task *rt;
303 char buf1[64];303 char buf1[64];
304 char buf[512];304 char *buf;
305 u64 sum = 0;305 u64 sum = 0;
306 306
307 buf = kmalloc(128 + nreaders * 32, GFP_KERNEL);
308 if (!buf)
309 return 0;
307 buf[0] = 0;310 buf[0] = 0;
308 sprintf(buf, "Experiment #%d (Format: <THREAD-NUM>:<Total loop time in ns>)",311 sprintf(buf, "Experiment #%d (Format: <THREAD-NUM>:<Total loop time in ns>)",
309 exp_idx);312 exp_idx);
@@ -322,6 +325,7 @@ u64 process_durations(int n) · 12 unmodified lines
322 325
323 PERFOUT("%s\n", buf);326 PERFOUT("%s\n", buf);
324 327
328 kfree(buf);
325 return sum;329 return sum;
326}330}
327 331

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