mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-03 23:58:05 +00:00
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>
This commit is contained in:
parent
f518f154ec
commit
2e90de76f2
1 changed files with 5 additions and 1 deletions
|
@ -301,9 +301,12 @@ u64 process_durations(int n)
|
||||||
int i;
|
int i;
|
||||||
struct reader_task *rt;
|
struct reader_task *rt;
|
||||||
char buf1[64];
|
char buf1[64];
|
||||||
char buf[512];
|
char *buf;
|
||||||
u64 sum = 0;
|
u64 sum = 0;
|
||||||
|
|
||||||
|
buf = kmalloc(128 + nreaders * 32, GFP_KERNEL);
|
||||||
|
if (!buf)
|
||||||
|
return 0;
|
||||||
buf[0] = 0;
|
buf[0] = 0;
|
||||||
sprintf(buf, "Experiment #%d (Format: <THREAD-NUM>:<Total loop time in ns>)",
|
sprintf(buf, "Experiment #%d (Format: <THREAD-NUM>:<Total loop time in ns>)",
|
||||||
exp_idx);
|
exp_idx);
|
||||||
|
@ -322,6 +325,7 @@ u64 process_durations(int n)
|
||||||
|
|
||||||
PERFOUT("%s\n", buf);
|
PERFOUT("%s\n", buf);
|
||||||
|
|
||||||
|
kfree(buf);
|
||||||
return sum;
|
return sum;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue