blob: 2b8579d5a5445e0302279375753f6664dd6c3931 [file] [log] [blame]
Paul E. McKenney8704baa2015-12-31 18:33:22 -08001/*
2 * Read-Copy Update module-based performance-test facility
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, you can access it online at
16 * http://www.gnu.org/licenses/gpl-2.0.html.
17 *
18 * Copyright (C) IBM Corporation, 2015
19 *
20 * Authors: Paul E. McKenney <paulmck@us.ibm.com>
21 */
22#include <linux/types.h>
23#include <linux/kernel.h>
24#include <linux/init.h>
25#include <linux/module.h>
26#include <linux/kthread.h>
27#include <linux/err.h>
28#include <linux/spinlock.h>
29#include <linux/smp.h>
30#include <linux/rcupdate.h>
31#include <linux/interrupt.h>
32#include <linux/sched.h>
33#include <linux/atomic.h>
34#include <linux/bitops.h>
35#include <linux/completion.h>
36#include <linux/moduleparam.h>
37#include <linux/percpu.h>
38#include <linux/notifier.h>
39#include <linux/reboot.h>
40#include <linux/freezer.h>
41#include <linux/cpu.h>
42#include <linux/delay.h>
43#include <linux/stat.h>
44#include <linux/srcu.h>
45#include <linux/slab.h>
46#include <asm/byteorder.h>
47#include <linux/torture.h>
48#include <linux/vmalloc.h>
49
50MODULE_LICENSE("GPL");
51MODULE_AUTHOR("Paul E. McKenney <paulmck@linux.vnet.ibm.com>");
52
53#define PERF_FLAG "-perf:"
54#define PERFOUT_STRING(s) \
SeongJae Parka56fefa2016-08-21 16:54:39 +090055 pr_alert("%s" PERF_FLAG " %s\n", perf_type, s)
Paul E. McKenney8704baa2015-12-31 18:33:22 -080056#define VERBOSE_PERFOUT_STRING(s) \
57 do { if (verbose) pr_alert("%s" PERF_FLAG " %s\n", perf_type, s); } while (0)
58#define VERBOSE_PERFOUT_ERRSTRING(s) \
59 do { if (verbose) pr_alert("%s" PERF_FLAG "!!! %s\n", perf_type, s); } while (0)
60
Boqun Fengaf06d4f2016-05-25 09:25:33 +080061torture_param(bool, gp_exp, false, "Use expedited GP wait primitives");
Paul E. McKenneydf37e662016-01-30 20:56:38 -080062torture_param(int, holdoff, 10, "Holdoff time before test start (s)");
Paul E. McKenney8704baa2015-12-31 18:33:22 -080063torture_param(int, nreaders, -1, "Number of RCU reader threads");
64torture_param(int, nwriters, -1, "Number of RCU updater threads");
65torture_param(bool, shutdown, false, "Shutdown at end of performance tests.");
66torture_param(bool, verbose, true, "Enable verbose debugging printk()s");
67
68static char *perf_type = "rcu";
69module_param(perf_type, charp, 0444);
70MODULE_PARM_DESC(perf_type, "Type of RCU to performance-test (rcu, rcu_bh, ...)");
71
72static int nrealreaders;
73static int nrealwriters;
74static struct task_struct **writer_tasks;
75static struct task_struct **reader_tasks;
76static struct task_struct *shutdown_task;
77
78static u64 **writer_durations;
79static int *writer_n_durations;
80static atomic_t n_rcu_perf_reader_started;
81static atomic_t n_rcu_perf_writer_started;
82static atomic_t n_rcu_perf_writer_finished;
83static wait_queue_head_t shutdown_wq;
84static u64 t_rcu_perf_writer_started;
85static u64 t_rcu_perf_writer_finished;
86static unsigned long b_rcu_perf_writer_started;
87static unsigned long b_rcu_perf_writer_finished;
88
89static int rcu_perf_writer_state;
90#define RTWS_INIT 0
91#define RTWS_EXP_SYNC 1
92#define RTWS_SYNC 2
93#define RTWS_IDLE 2
94#define RTWS_STOPPING 3
95
96#define MAX_MEAS 10000
97#define MIN_MEAS 100
98
Paul E. McKenneyf8cbdee2016-04-19 13:03:18 -070099static int perf_runnable = IS_ENABLED(MODULE);
Paul E. McKenney8704baa2015-12-31 18:33:22 -0800100module_param(perf_runnable, int, 0444);
101MODULE_PARM_DESC(perf_runnable, "Start rcuperf at boot");
102
103/*
104 * Operations vector for selecting different types of tests.
105 */
106
107struct rcu_perf_ops {
108 int ptype;
109 void (*init)(void);
110 void (*cleanup)(void);
111 int (*readlock)(void);
112 void (*readunlock)(int idx);
113 unsigned long (*started)(void);
114 unsigned long (*completed)(void);
115 unsigned long (*exp_completed)(void);
116 void (*sync)(void);
117 void (*exp_sync)(void);
118 const char *name;
119};
120
121static struct rcu_perf_ops *cur_ops;
122
123/*
124 * Definitions for rcu perf testing.
125 */
126
127static int rcu_perf_read_lock(void) __acquires(RCU)
128{
129 rcu_read_lock();
130 return 0;
131}
132
133static void rcu_perf_read_unlock(int idx) __releases(RCU)
134{
135 rcu_read_unlock();
136}
137
138static unsigned long __maybe_unused rcu_no_completed(void)
139{
140 return 0;
141}
142
143static void rcu_sync_perf_init(void)
144{
145}
146
147static struct rcu_perf_ops rcu_ops = {
148 .ptype = RCU_FLAVOR,
149 .init = rcu_sync_perf_init,
150 .readlock = rcu_perf_read_lock,
151 .readunlock = rcu_perf_read_unlock,
152 .started = rcu_batches_started,
153 .completed = rcu_batches_completed,
154 .exp_completed = rcu_exp_batches_completed,
155 .sync = synchronize_rcu,
156 .exp_sync = synchronize_rcu_expedited,
157 .name = "rcu"
158};
159
160/*
161 * Definitions for rcu_bh perf testing.
162 */
163
164static int rcu_bh_perf_read_lock(void) __acquires(RCU_BH)
165{
166 rcu_read_lock_bh();
167 return 0;
168}
169
170static void rcu_bh_perf_read_unlock(int idx) __releases(RCU_BH)
171{
172 rcu_read_unlock_bh();
173}
174
175static struct rcu_perf_ops rcu_bh_ops = {
176 .ptype = RCU_BH_FLAVOR,
177 .init = rcu_sync_perf_init,
178 .readlock = rcu_bh_perf_read_lock,
179 .readunlock = rcu_bh_perf_read_unlock,
180 .started = rcu_batches_started_bh,
181 .completed = rcu_batches_completed_bh,
182 .exp_completed = rcu_exp_batches_completed_sched,
183 .sync = synchronize_rcu_bh,
184 .exp_sync = synchronize_rcu_bh_expedited,
185 .name = "rcu_bh"
186};
187
188/*
189 * Definitions for srcu perf testing.
190 */
191
192DEFINE_STATIC_SRCU(srcu_ctl_perf);
193static struct srcu_struct *srcu_ctlp = &srcu_ctl_perf;
194
195static int srcu_perf_read_lock(void) __acquires(srcu_ctlp)
196{
197 return srcu_read_lock(srcu_ctlp);
198}
199
200static void srcu_perf_read_unlock(int idx) __releases(srcu_ctlp)
201{
202 srcu_read_unlock(srcu_ctlp, idx);
203}
204
205static unsigned long srcu_perf_completed(void)
206{
207 return srcu_batches_completed(srcu_ctlp);
208}
209
210static void srcu_perf_synchronize(void)
211{
212 synchronize_srcu(srcu_ctlp);
213}
214
215static void srcu_perf_synchronize_expedited(void)
216{
217 synchronize_srcu_expedited(srcu_ctlp);
218}
219
220static struct rcu_perf_ops srcu_ops = {
221 .ptype = SRCU_FLAVOR,
222 .init = rcu_sync_perf_init,
223 .readlock = srcu_perf_read_lock,
224 .readunlock = srcu_perf_read_unlock,
225 .started = NULL,
226 .completed = srcu_perf_completed,
227 .exp_completed = srcu_perf_completed,
228 .sync = srcu_perf_synchronize,
229 .exp_sync = srcu_perf_synchronize_expedited,
230 .name = "srcu"
231};
232
233/*
234 * Definitions for sched perf testing.
235 */
236
237static int sched_perf_read_lock(void)
238{
239 preempt_disable();
240 return 0;
241}
242
243static void sched_perf_read_unlock(int idx)
244{
245 preempt_enable();
246}
247
248static struct rcu_perf_ops sched_ops = {
249 .ptype = RCU_SCHED_FLAVOR,
250 .init = rcu_sync_perf_init,
251 .readlock = sched_perf_read_lock,
252 .readunlock = sched_perf_read_unlock,
253 .started = rcu_batches_started_sched,
254 .completed = rcu_batches_completed_sched,
255 .exp_completed = rcu_exp_batches_completed_sched,
256 .sync = synchronize_sched,
257 .exp_sync = synchronize_sched_expedited,
258 .name = "sched"
259};
260
261#ifdef CONFIG_TASKS_RCU
262
263/*
264 * Definitions for RCU-tasks perf testing.
265 */
266
267static int tasks_perf_read_lock(void)
268{
269 return 0;
270}
271
272static void tasks_perf_read_unlock(int idx)
273{
274}
275
276static struct rcu_perf_ops tasks_ops = {
277 .ptype = RCU_TASKS_FLAVOR,
278 .init = rcu_sync_perf_init,
279 .readlock = tasks_perf_read_lock,
280 .readunlock = tasks_perf_read_unlock,
281 .started = rcu_no_completed,
282 .completed = rcu_no_completed,
283 .sync = synchronize_rcu_tasks,
284 .exp_sync = synchronize_rcu_tasks,
285 .name = "tasks"
286};
287
288#define RCUPERF_TASKS_OPS &tasks_ops,
289
290static bool __maybe_unused torturing_tasks(void)
291{
292 return cur_ops == &tasks_ops;
293}
294
295#else /* #ifdef CONFIG_TASKS_RCU */
296
297#define RCUPERF_TASKS_OPS
298
299static bool __maybe_unused torturing_tasks(void)
300{
301 return false;
302}
303
304#endif /* #else #ifdef CONFIG_TASKS_RCU */
305
306/*
307 * If performance tests complete, wait for shutdown to commence.
308 */
309static void rcu_perf_wait_shutdown(void)
310{
311 cond_resched_rcu_qs();
312 if (atomic_read(&n_rcu_perf_writer_finished) < nrealwriters)
313 return;
314 while (!torture_must_stop())
315 schedule_timeout_uninterruptible(1);
316}
317
318/*
319 * RCU perf reader kthread. Repeatedly does empty RCU read-side
320 * critical section, minimizing update-side interference.
321 */
322static int
323rcu_perf_reader(void *arg)
324{
325 unsigned long flags;
326 int idx;
Paul E. McKenney6b558c42016-01-12 14:15:40 -0800327 long me = (long)arg;
Paul E. McKenney8704baa2015-12-31 18:33:22 -0800328
329 VERBOSE_PERFOUT_STRING("rcu_perf_reader task started");
Paul E. McKenney6b558c42016-01-12 14:15:40 -0800330 set_cpus_allowed_ptr(current, cpumask_of(me % nr_cpu_ids));
Paul E. McKenney8704baa2015-12-31 18:33:22 -0800331 set_user_nice(current, MAX_NICE);
332 atomic_inc(&n_rcu_perf_reader_started);
333
334 do {
335 local_irq_save(flags);
336 idx = cur_ops->readlock();
337 cur_ops->readunlock(idx);
338 local_irq_restore(flags);
339 rcu_perf_wait_shutdown();
340 } while (!torture_must_stop());
341 torture_kthread_stopping("rcu_perf_reader");
342 return 0;
343}
344
345/*
346 * RCU perf writer kthread. Repeatedly does a grace period.
347 */
348static int
349rcu_perf_writer(void *arg)
350{
351 int i = 0;
352 int i_max;
353 long me = (long)arg;
Paul E. McKenney2094c992016-01-12 15:17:21 -0800354 struct sched_param sp;
Paul E. McKenney8704baa2015-12-31 18:33:22 -0800355 bool started = false, done = false, alldone = false;
356 u64 t;
357 u64 *wdp;
358 u64 *wdpp = writer_durations[me];
359
360 VERBOSE_PERFOUT_STRING("rcu_perf_writer task started");
Paul E. McKenney8704baa2015-12-31 18:33:22 -0800361 WARN_ON(!wdpp);
Paul E. McKenney6b558c42016-01-12 14:15:40 -0800362 set_cpus_allowed_ptr(current, cpumask_of(me % nr_cpu_ids));
Paul E. McKenney2094c992016-01-12 15:17:21 -0800363 sp.sched_priority = 1;
364 sched_setscheduler_nocheck(current, SCHED_FIFO, &sp);
Paul E. McKenneydf37e662016-01-30 20:56:38 -0800365
366 if (holdoff)
367 schedule_timeout_uninterruptible(holdoff * HZ);
368
Paul E. McKenney8704baa2015-12-31 18:33:22 -0800369 t = ktime_get_mono_fast_ns();
370 if (atomic_inc_return(&n_rcu_perf_writer_started) >= nrealwriters) {
371 t_rcu_perf_writer_started = t;
372 if (gp_exp) {
373 b_rcu_perf_writer_started =
374 cur_ops->exp_completed() / 2;
375 } else {
376 b_rcu_perf_writer_started =
377 cur_ops->completed();
378 }
379 }
380
381 do {
382 wdp = &wdpp[i];
383 *wdp = ktime_get_mono_fast_ns();
384 if (gp_exp) {
385 rcu_perf_writer_state = RTWS_EXP_SYNC;
386 cur_ops->exp_sync();
387 } else {
388 rcu_perf_writer_state = RTWS_SYNC;
389 cur_ops->sync();
390 }
391 rcu_perf_writer_state = RTWS_IDLE;
392 t = ktime_get_mono_fast_ns();
393 *wdp = t - *wdp;
394 i_max = i;
395 if (!started &&
396 atomic_read(&n_rcu_perf_writer_started) >= nrealwriters)
397 started = true;
398 if (!done && i >= MIN_MEAS) {
399 done = true;
Paul E. McKenney620316e2016-01-30 21:32:09 -0800400 sp.sched_priority = 0;
401 sched_setscheduler_nocheck(current,
402 SCHED_NORMAL, &sp);
SeongJae Parka56fefa2016-08-21 16:54:39 +0900403 pr_alert("%s%s rcu_perf_writer %ld has %d measurements\n",
404 perf_type, PERF_FLAG, me, MIN_MEAS);
Paul E. McKenney8704baa2015-12-31 18:33:22 -0800405 if (atomic_inc_return(&n_rcu_perf_writer_finished) >=
406 nrealwriters) {
Paul E. McKenney620316e2016-01-30 21:32:09 -0800407 schedule_timeout_interruptible(10);
Paul E. McKenneyac2bb272016-01-29 14:58:17 -0800408 rcu_ftrace_dump(DUMP_ALL);
Paul E. McKenney8704baa2015-12-31 18:33:22 -0800409 PERFOUT_STRING("Test complete");
410 t_rcu_perf_writer_finished = t;
411 if (gp_exp) {
412 b_rcu_perf_writer_finished =
413 cur_ops->exp_completed() / 2;
414 } else {
415 b_rcu_perf_writer_finished =
416 cur_ops->completed();
417 }
Artem Savkove6fb1fc2016-02-07 13:31:39 +0100418 if (shutdown) {
419 smp_mb(); /* Assign before wake. */
420 wake_up(&shutdown_wq);
421 }
Paul E. McKenney8704baa2015-12-31 18:33:22 -0800422 }
423 }
424 if (done && !alldone &&
425 atomic_read(&n_rcu_perf_writer_finished) >= nrealwriters)
426 alldone = true;
427 if (started && !alldone && i < MAX_MEAS - 1)
428 i++;
429 rcu_perf_wait_shutdown();
430 } while (!torture_must_stop());
431 rcu_perf_writer_state = RTWS_STOPPING;
432 writer_n_durations[me] = i_max;
433 torture_kthread_stopping("rcu_perf_writer");
434 return 0;
435}
436
437static inline void
438rcu_perf_print_module_parms(struct rcu_perf_ops *cur_ops, const char *tag)
439{
440 pr_alert("%s" PERF_FLAG
441 "--- %s: nreaders=%d nwriters=%d verbose=%d shutdown=%d\n",
442 perf_type, tag, nrealreaders, nrealwriters, verbose, shutdown);
443}
444
445static void
446rcu_perf_cleanup(void)
447{
448 int i;
449 int j;
450 int ngps = 0;
451 u64 *wdp;
452 u64 *wdpp;
453
454 if (torture_cleanup_begin())
455 return;
Paul E. McKenney090eb572019-03-21 10:26:41 -0700456 if (!cur_ops) {
457 torture_cleanup_end();
458 return;
459 }
Paul E. McKenney8704baa2015-12-31 18:33:22 -0800460
461 if (reader_tasks) {
462 for (i = 0; i < nrealreaders; i++)
463 torture_stop_kthread(rcu_perf_reader,
464 reader_tasks[i]);
465 kfree(reader_tasks);
466 }
467
468 if (writer_tasks) {
469 for (i = 0; i < nrealwriters; i++) {
470 torture_stop_kthread(rcu_perf_writer,
471 writer_tasks[i]);
472 if (!writer_n_durations)
473 continue;
474 j = writer_n_durations[i];
475 pr_alert("%s%s writer %d gps: %d\n",
476 perf_type, PERF_FLAG, i, j);
477 ngps += j;
478 }
479 pr_alert("%s%s start: %llu end: %llu duration: %llu gps: %d batches: %ld\n",
480 perf_type, PERF_FLAG,
481 t_rcu_perf_writer_started, t_rcu_perf_writer_finished,
482 t_rcu_perf_writer_finished -
483 t_rcu_perf_writer_started,
484 ngps,
485 b_rcu_perf_writer_finished -
486 b_rcu_perf_writer_started);
487 for (i = 0; i < nrealwriters; i++) {
488 if (!writer_durations)
489 break;
490 if (!writer_n_durations)
491 continue;
492 wdpp = writer_durations[i];
493 if (!wdpp)
494 continue;
495 for (j = 0; j <= writer_n_durations[i]; j++) {
496 wdp = &wdpp[j];
497 pr_alert("%s%s %4d writer-duration: %5d %llu\n",
498 perf_type, PERF_FLAG,
499 i, j, *wdp);
500 if (j % 100 == 0)
501 schedule_timeout_uninterruptible(1);
502 }
503 kfree(writer_durations[i]);
504 }
505 kfree(writer_tasks);
506 kfree(writer_durations);
507 kfree(writer_n_durations);
508 }
509
510 /* Do flavor-specific cleanup operations. */
511 if (cur_ops->cleanup != NULL)
512 cur_ops->cleanup();
513
514 torture_cleanup_end();
515}
516
517/*
518 * Return the number if non-negative. If -1, the number of CPUs.
519 * If less than -1, that much less than the number of CPUs, but
520 * at least one.
521 */
522static int compute_real(int n)
523{
524 int nr;
525
526 if (n >= 0) {
527 nr = n;
528 } else {
529 nr = num_online_cpus() + 1 + n;
530 if (nr <= 0)
531 nr = 1;
532 }
533 return nr;
534}
535
536/*
537 * RCU perf shutdown kthread. Just waits to be awakened, then shuts
538 * down system.
539 */
540static int
541rcu_perf_shutdown(void *arg)
542{
543 do {
544 wait_event(shutdown_wq,
545 atomic_read(&n_rcu_perf_writer_finished) >=
546 nrealwriters);
547 } while (atomic_read(&n_rcu_perf_writer_finished) < nrealwriters);
548 smp_mb(); /* Wake before output. */
549 rcu_perf_cleanup();
550 kernel_power_off();
551 return -EINVAL;
552}
553
554static int __init
555rcu_perf_init(void)
556{
557 long i;
558 int firsterr = 0;
559 static struct rcu_perf_ops *perf_ops[] = {
560 &rcu_ops, &rcu_bh_ops, &srcu_ops, &sched_ops,
561 RCUPERF_TASKS_OPS
562 };
563
564 if (!torture_init_begin(perf_type, verbose, &perf_runnable))
565 return -EBUSY;
566
567 /* Process args and tell the world that the perf'er is on the job. */
568 for (i = 0; i < ARRAY_SIZE(perf_ops); i++) {
569 cur_ops = perf_ops[i];
570 if (strcmp(perf_type, cur_ops->name) == 0)
571 break;
572 }
573 if (i == ARRAY_SIZE(perf_ops)) {
574 pr_alert("rcu-perf: invalid perf type: \"%s\"\n",
575 perf_type);
576 pr_alert("rcu-perf types:");
577 for (i = 0; i < ARRAY_SIZE(perf_ops); i++)
578 pr_alert(" %s", perf_ops[i]->name);
579 pr_alert("\n");
580 firsterr = -EINVAL;
Paul E. McKenney090eb572019-03-21 10:26:41 -0700581 cur_ops = NULL;
Paul E. McKenney8704baa2015-12-31 18:33:22 -0800582 goto unwind;
583 }
584 if (cur_ops->init)
585 cur_ops->init();
586
587 nrealwriters = compute_real(nwriters);
588 nrealreaders = compute_real(nreaders);
589 atomic_set(&n_rcu_perf_reader_started, 0);
590 atomic_set(&n_rcu_perf_writer_started, 0);
591 atomic_set(&n_rcu_perf_writer_finished, 0);
592 rcu_perf_print_module_parms(cur_ops, "Start of test");
593
594 /* Start up the kthreads. */
595
596 if (shutdown) {
597 init_waitqueue_head(&shutdown_wq);
598 firsterr = torture_create_kthread(rcu_perf_shutdown, NULL,
599 shutdown_task);
600 if (firsterr)
601 goto unwind;
602 schedule_timeout_uninterruptible(1);
603 }
604 reader_tasks = kcalloc(nrealreaders, sizeof(reader_tasks[0]),
605 GFP_KERNEL);
606 if (reader_tasks == NULL) {
607 VERBOSE_PERFOUT_ERRSTRING("out of memory");
608 firsterr = -ENOMEM;
609 goto unwind;
610 }
611 for (i = 0; i < nrealreaders; i++) {
Paul E. McKenney6b558c42016-01-12 14:15:40 -0800612 firsterr = torture_create_kthread(rcu_perf_reader, (void *)i,
Paul E. McKenney8704baa2015-12-31 18:33:22 -0800613 reader_tasks[i]);
614 if (firsterr)
615 goto unwind;
616 }
617 while (atomic_read(&n_rcu_perf_reader_started) < nrealreaders)
618 schedule_timeout_uninterruptible(1);
619 writer_tasks = kcalloc(nrealwriters, sizeof(reader_tasks[0]),
620 GFP_KERNEL);
621 writer_durations = kcalloc(nrealwriters, sizeof(*writer_durations),
622 GFP_KERNEL);
623 writer_n_durations =
624 kcalloc(nrealwriters, sizeof(*writer_n_durations),
625 GFP_KERNEL);
626 if (!writer_tasks || !writer_durations || !writer_n_durations) {
627 VERBOSE_PERFOUT_ERRSTRING("out of memory");
628 firsterr = -ENOMEM;
629 goto unwind;
630 }
Boqun Fengaf06d4f2016-05-25 09:25:33 +0800631 if (rcu_gp_is_expedited() && !rcu_gp_is_normal() && !gp_exp) {
632 VERBOSE_PERFOUT_ERRSTRING("All grace periods expedited, no normal ones to measure!");
633 firsterr = -EINVAL;
634 goto unwind;
635 }
636 if (rcu_gp_is_normal() && gp_exp) {
637 VERBOSE_PERFOUT_ERRSTRING("All grace periods normal, no expedited ones to measure!");
638 firsterr = -EINVAL;
639 goto unwind;
640 }
Paul E. McKenney8704baa2015-12-31 18:33:22 -0800641 for (i = 0; i < nrealwriters; i++) {
642 writer_durations[i] =
643 kcalloc(MAX_MEAS, sizeof(*writer_durations[i]),
644 GFP_KERNEL);
Wei Yongjun05dbbfe2016-06-13 15:20:39 +0000645 if (!writer_durations[i]) {
646 firsterr = -ENOMEM;
Paul E. McKenney8704baa2015-12-31 18:33:22 -0800647 goto unwind;
Wei Yongjun05dbbfe2016-06-13 15:20:39 +0000648 }
Paul E. McKenney8704baa2015-12-31 18:33:22 -0800649 firsterr = torture_create_kthread(rcu_perf_writer, (void *)i,
650 writer_tasks[i]);
651 if (firsterr)
652 goto unwind;
653 }
654 torture_init_end();
655 return 0;
656
657unwind:
658 torture_init_end();
659 rcu_perf_cleanup();
660 return firsterr;
661}
662
663module_init(rcu_perf_init);
664module_exit(rcu_perf_cleanup);