1 /* SPDX-License-Identifier: GPL-2.0 */
2 #include <stdlib.h>
3 #include <linux/compiler.h>
4 #include "../tests.h"
5 
6 /* We want to check these symbols in perf script */
7 noinline void leaf(volatile int b);
8 noinline void parent(volatile int b);
9 
10 static volatile int a;
11 
12 noinline void leaf(volatile int b)
13 {
14 	for (;;)
15 		a += b;
16 }
17 
18 noinline void parent(volatile int b)
19 {
20 	leaf(b);
21 }
22 
23 static int leafloop(int argc, const char **argv)
24 {
25 	int c = 1;
26 
27 	if (argc > 0)
28 		c = atoi(argv[0]);
29 
30 	parent(c);
31 	return 0;
32 }
33 
34 DEFINE_WORKLOAD(leafloop);
35