aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/rcu
diff options
context:
space:
mode:
authorPaul E. McKenney <paulmck@kernel.org>2020-05-25 17:45:03 -0700
committerPaul E. McKenney <paulmck@kernel.org>2020-06-29 12:00:44 -0700
commit2e90de76f226f11fe26c871aa321be28152f565a (patch)
treef6c28440faa82b028a41e31db9681c6c81219a2e /kernel/rcu
parentrefperf: Dynamically allocate experiment-summary output buffer (diff)
downloadlinux-dev-2e90de76f226f11fe26c871aa321be28152f565a.tar.xz
linux-dev-2e90de76f226f11fe26c871aa321be28152f565a.zip
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>
Diffstat (limited to 'kernel/rcu')
-rw-r--r--kernel/rcu/refperf.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/kernel/rcu/refperf.c b/kernel/rcu/refperf.c
index 75b9cceaece1..fc940e3dba1f 100644
--- a/kernel/rcu/refperf.c
+++ b/kernel/rcu/refperf.c
@@ -301,9 +301,12 @@ u64 process_durations(int n)
int i;
struct reader_task *rt;
char buf1[64];
- char buf[512];
+ char *buf;
u64 sum = 0;
+ buf = kmalloc(128 + nreaders * 32, GFP_KERNEL);
+ if (!buf)
+ return 0;
buf[0] = 0;
sprintf(buf, "Experiment #%d (Format: <THREAD-NUM>:<Total loop time in ns>)",
exp_idx);
@@ -322,6 +325,7 @@ u64 process_durations(int n)
PERFOUT("%s\n", buf);
+ kfree(buf);
return sum;
}