xref: /openbmc/linux/tools/testing/radix-tree/main.c (revision 268f42de718128cd0301293177e79c08c38e39a6)
11366c37eSMatthew Wilcox #include <stdio.h>
21366c37eSMatthew Wilcox #include <stdlib.h>
31366c37eSMatthew Wilcox #include <unistd.h>
41366c37eSMatthew Wilcox #include <time.h>
51366c37eSMatthew Wilcox #include <assert.h>
61366c37eSMatthew Wilcox 
71366c37eSMatthew Wilcox #include <linux/slab.h>
81366c37eSMatthew Wilcox #include <linux/radix-tree.h>
91366c37eSMatthew Wilcox 
101366c37eSMatthew Wilcox #include "test.h"
111366c37eSMatthew Wilcox #include "regression.h"
121366c37eSMatthew Wilcox 
131366c37eSMatthew Wilcox void __gang_check(unsigned long middle, long down, long up, int chunk, int hop)
141366c37eSMatthew Wilcox {
151366c37eSMatthew Wilcox 	long idx;
161366c37eSMatthew Wilcox 	RADIX_TREE(tree, GFP_KERNEL);
171366c37eSMatthew Wilcox 
181366c37eSMatthew Wilcox 	middle = 1 << 30;
191366c37eSMatthew Wilcox 
201366c37eSMatthew Wilcox 	for (idx = -down; idx < up; idx++)
211366c37eSMatthew Wilcox 		item_insert(&tree, middle + idx);
221366c37eSMatthew Wilcox 
231366c37eSMatthew Wilcox 	item_check_absent(&tree, middle - down - 1);
241366c37eSMatthew Wilcox 	for (idx = -down; idx < up; idx++)
251366c37eSMatthew Wilcox 		item_check_present(&tree, middle + idx);
261366c37eSMatthew Wilcox 	item_check_absent(&tree, middle + up);
271366c37eSMatthew Wilcox 
281366c37eSMatthew Wilcox 	item_gang_check_present(&tree, middle - down,
291366c37eSMatthew Wilcox 			up + down, chunk, hop);
301366c37eSMatthew Wilcox 	item_full_scan(&tree, middle - down, down + up, chunk);
311366c37eSMatthew Wilcox 	item_kill_tree(&tree);
321366c37eSMatthew Wilcox }
331366c37eSMatthew Wilcox 
341366c37eSMatthew Wilcox void gang_check(void)
351366c37eSMatthew Wilcox {
361366c37eSMatthew Wilcox 	__gang_check(1 << 30, 128, 128, 35, 2);
371366c37eSMatthew Wilcox 	__gang_check(1 << 31, 128, 128, 32, 32);
381366c37eSMatthew Wilcox 	__gang_check(1 << 31, 128, 128, 32, 100);
391366c37eSMatthew Wilcox 	__gang_check(1 << 31, 128, 128, 17, 7);
401366c37eSMatthew Wilcox 	__gang_check(0xffff0000, 0, 65536, 17, 7);
411366c37eSMatthew Wilcox 	__gang_check(0xfffffffe, 1, 1, 17, 7);
421366c37eSMatthew Wilcox }
431366c37eSMatthew Wilcox 
441366c37eSMatthew Wilcox void __big_gang_check(void)
451366c37eSMatthew Wilcox {
461366c37eSMatthew Wilcox 	unsigned long start;
471366c37eSMatthew Wilcox 	int wrapped = 0;
481366c37eSMatthew Wilcox 
491366c37eSMatthew Wilcox 	start = 0;
501366c37eSMatthew Wilcox 	do {
511366c37eSMatthew Wilcox 		unsigned long old_start;
521366c37eSMatthew Wilcox 
531366c37eSMatthew Wilcox //		printf("0x%08lx\n", start);
541366c37eSMatthew Wilcox 		__gang_check(start, rand() % 113 + 1, rand() % 71,
551366c37eSMatthew Wilcox 				rand() % 157, rand() % 91 + 1);
561366c37eSMatthew Wilcox 		old_start = start;
571366c37eSMatthew Wilcox 		start += rand() % 1000000;
581366c37eSMatthew Wilcox 		start %= 1ULL << 33;
591366c37eSMatthew Wilcox 		if (start < old_start)
601366c37eSMatthew Wilcox 			wrapped = 1;
611366c37eSMatthew Wilcox 	} while (!wrapped);
621366c37eSMatthew Wilcox }
631366c37eSMatthew Wilcox 
64aa1d62d8SRoss Zwisler void big_gang_check(bool long_run)
651366c37eSMatthew Wilcox {
661366c37eSMatthew Wilcox 	int i;
671366c37eSMatthew Wilcox 
68aa1d62d8SRoss Zwisler 	for (i = 0; i < (long_run ? 1000 : 3); i++) {
691366c37eSMatthew Wilcox 		__big_gang_check();
701366c37eSMatthew Wilcox 		printf("%d ", i);
711366c37eSMatthew Wilcox 		fflush(stdout);
721366c37eSMatthew Wilcox 	}
731366c37eSMatthew Wilcox }
741366c37eSMatthew Wilcox 
751366c37eSMatthew Wilcox void add_and_check(void)
761366c37eSMatthew Wilcox {
771366c37eSMatthew Wilcox 	RADIX_TREE(tree, GFP_KERNEL);
781366c37eSMatthew Wilcox 
791366c37eSMatthew Wilcox 	item_insert(&tree, 44);
801366c37eSMatthew Wilcox 	item_check_present(&tree, 44);
811366c37eSMatthew Wilcox 	item_check_absent(&tree, 43);
821366c37eSMatthew Wilcox 	item_kill_tree(&tree);
831366c37eSMatthew Wilcox }
841366c37eSMatthew Wilcox 
851366c37eSMatthew Wilcox void dynamic_height_check(void)
861366c37eSMatthew Wilcox {
871366c37eSMatthew Wilcox 	int i;
881366c37eSMatthew Wilcox 	RADIX_TREE(tree, GFP_KERNEL);
891366c37eSMatthew Wilcox 	tree_verify_min_height(&tree, 0);
901366c37eSMatthew Wilcox 
911366c37eSMatthew Wilcox 	item_insert(&tree, 42);
921366c37eSMatthew Wilcox 	tree_verify_min_height(&tree, 42);
931366c37eSMatthew Wilcox 
941366c37eSMatthew Wilcox 	item_insert(&tree, 1000000);
951366c37eSMatthew Wilcox 	tree_verify_min_height(&tree, 1000000);
961366c37eSMatthew Wilcox 
971366c37eSMatthew Wilcox 	assert(item_delete(&tree, 1000000));
981366c37eSMatthew Wilcox 	tree_verify_min_height(&tree, 42);
991366c37eSMatthew Wilcox 
1001366c37eSMatthew Wilcox 	assert(item_delete(&tree, 42));
1011366c37eSMatthew Wilcox 	tree_verify_min_height(&tree, 0);
1021366c37eSMatthew Wilcox 
1031366c37eSMatthew Wilcox 	for (i = 0; i < 1000; i++) {
1041366c37eSMatthew Wilcox 		item_insert(&tree, i);
1051366c37eSMatthew Wilcox 		tree_verify_min_height(&tree, i);
1061366c37eSMatthew Wilcox 	}
1071366c37eSMatthew Wilcox 
1081366c37eSMatthew Wilcox 	i--;
1091366c37eSMatthew Wilcox 	for (;;) {
1101366c37eSMatthew Wilcox 		assert(item_delete(&tree, i));
1111366c37eSMatthew Wilcox 		if (i == 0) {
1121366c37eSMatthew Wilcox 			tree_verify_min_height(&tree, 0);
1131366c37eSMatthew Wilcox 			break;
1141366c37eSMatthew Wilcox 		}
1151366c37eSMatthew Wilcox 		i--;
1161366c37eSMatthew Wilcox 		tree_verify_min_height(&tree, i);
1171366c37eSMatthew Wilcox 	}
1181366c37eSMatthew Wilcox 
1191366c37eSMatthew Wilcox 	item_kill_tree(&tree);
1201366c37eSMatthew Wilcox }
1211366c37eSMatthew Wilcox 
1221366c37eSMatthew Wilcox void check_copied_tags(struct radix_tree_root *tree, unsigned long start, unsigned long end, unsigned long *idx, int count, int fromtag, int totag)
1231366c37eSMatthew Wilcox {
1241366c37eSMatthew Wilcox 	int i;
1251366c37eSMatthew Wilcox 
1261366c37eSMatthew Wilcox 	for (i = 0; i < count; i++) {
1271366c37eSMatthew Wilcox /*		if (i % 1000 == 0)
1281366c37eSMatthew Wilcox 			putchar('.'); */
1291366c37eSMatthew Wilcox 		if (idx[i] < start || idx[i] > end) {
1301366c37eSMatthew Wilcox 			if (item_tag_get(tree, idx[i], totag)) {
1311366c37eSMatthew Wilcox 				printf("%lu-%lu: %lu, tags %d-%d\n", start, end, idx[i], item_tag_get(tree, idx[i], fromtag), item_tag_get(tree, idx[i], totag));
1321366c37eSMatthew Wilcox 			}
1331366c37eSMatthew Wilcox 			assert(!item_tag_get(tree, idx[i], totag));
1341366c37eSMatthew Wilcox 			continue;
1351366c37eSMatthew Wilcox 		}
1361366c37eSMatthew Wilcox 		if (item_tag_get(tree, idx[i], fromtag) ^
1371366c37eSMatthew Wilcox 			item_tag_get(tree, idx[i], totag)) {
1381366c37eSMatthew Wilcox 			printf("%lu-%lu: %lu, tags %d-%d\n", start, end, idx[i], item_tag_get(tree, idx[i], fromtag), item_tag_get(tree, idx[i], totag));
1391366c37eSMatthew Wilcox 		}
1401366c37eSMatthew Wilcox 		assert(!(item_tag_get(tree, idx[i], fromtag) ^
1411366c37eSMatthew Wilcox 			 item_tag_get(tree, idx[i], totag)));
1421366c37eSMatthew Wilcox 	}
1431366c37eSMatthew Wilcox }
1441366c37eSMatthew Wilcox 
1451366c37eSMatthew Wilcox #define ITEMS 50000
1461366c37eSMatthew Wilcox 
1471366c37eSMatthew Wilcox void copy_tag_check(void)
1481366c37eSMatthew Wilcox {
1491366c37eSMatthew Wilcox 	RADIX_TREE(tree, GFP_KERNEL);
1501366c37eSMatthew Wilcox 	unsigned long idx[ITEMS];
1511366c37eSMatthew Wilcox 	unsigned long start, end, count = 0, tagged, cur, tmp;
1521366c37eSMatthew Wilcox 	int i;
1531366c37eSMatthew Wilcox 
1541366c37eSMatthew Wilcox //	printf("generating radix tree indices...\n");
1551366c37eSMatthew Wilcox 	start = rand();
1561366c37eSMatthew Wilcox 	end = rand();
1571366c37eSMatthew Wilcox 	if (start > end && (rand() % 10)) {
1581366c37eSMatthew Wilcox 		cur = start;
1591366c37eSMatthew Wilcox 		start = end;
1601366c37eSMatthew Wilcox 		end = cur;
1611366c37eSMatthew Wilcox 	}
1621366c37eSMatthew Wilcox 	/* Specifically create items around the start and the end of the range
1631366c37eSMatthew Wilcox 	 * with high probability to check for off by one errors */
1641366c37eSMatthew Wilcox 	cur = rand();
1651366c37eSMatthew Wilcox 	if (cur & 1) {
1661366c37eSMatthew Wilcox 		item_insert(&tree, start);
1671366c37eSMatthew Wilcox 		if (cur & 2) {
1681366c37eSMatthew Wilcox 			if (start <= end)
1691366c37eSMatthew Wilcox 				count++;
1701366c37eSMatthew Wilcox 			item_tag_set(&tree, start, 0);
1711366c37eSMatthew Wilcox 		}
1721366c37eSMatthew Wilcox 	}
1731366c37eSMatthew Wilcox 	if (cur & 4) {
1741366c37eSMatthew Wilcox 		item_insert(&tree, start-1);
1751366c37eSMatthew Wilcox 		if (cur & 8)
1761366c37eSMatthew Wilcox 			item_tag_set(&tree, start-1, 0);
1771366c37eSMatthew Wilcox 	}
1781366c37eSMatthew Wilcox 	if (cur & 16) {
1791366c37eSMatthew Wilcox 		item_insert(&tree, end);
1801366c37eSMatthew Wilcox 		if (cur & 32) {
1811366c37eSMatthew Wilcox 			if (start <= end)
1821366c37eSMatthew Wilcox 				count++;
1831366c37eSMatthew Wilcox 			item_tag_set(&tree, end, 0);
1841366c37eSMatthew Wilcox 		}
1851366c37eSMatthew Wilcox 	}
1861366c37eSMatthew Wilcox 	if (cur & 64) {
1871366c37eSMatthew Wilcox 		item_insert(&tree, end+1);
1881366c37eSMatthew Wilcox 		if (cur & 128)
1891366c37eSMatthew Wilcox 			item_tag_set(&tree, end+1, 0);
1901366c37eSMatthew Wilcox 	}
1911366c37eSMatthew Wilcox 
1921366c37eSMatthew Wilcox 	for (i = 0; i < ITEMS; i++) {
1931366c37eSMatthew Wilcox 		do {
1941366c37eSMatthew Wilcox 			idx[i] = rand();
1951366c37eSMatthew Wilcox 		} while (item_lookup(&tree, idx[i]));
1961366c37eSMatthew Wilcox 
1971366c37eSMatthew Wilcox 		item_insert(&tree, idx[i]);
1981366c37eSMatthew Wilcox 		if (rand() & 1) {
1991366c37eSMatthew Wilcox 			item_tag_set(&tree, idx[i], 0);
2001366c37eSMatthew Wilcox 			if (idx[i] >= start && idx[i] <= end)
2011366c37eSMatthew Wilcox 				count++;
2021366c37eSMatthew Wilcox 		}
2031366c37eSMatthew Wilcox /*		if (i % 1000 == 0)
2041366c37eSMatthew Wilcox 			putchar('.'); */
2051366c37eSMatthew Wilcox 	}
2061366c37eSMatthew Wilcox 
2071366c37eSMatthew Wilcox //	printf("\ncopying tags...\n");
208*268f42deSMatthew Wilcox 	tagged = tag_tagged_items(&tree, NULL, start, end, ITEMS, 0, 1);
2091366c37eSMatthew Wilcox 
2101366c37eSMatthew Wilcox //	printf("checking copied tags\n");
2111366c37eSMatthew Wilcox 	assert(tagged == count);
2121366c37eSMatthew Wilcox 	check_copied_tags(&tree, start, end, idx, ITEMS, 0, 1);
2131366c37eSMatthew Wilcox 
2141366c37eSMatthew Wilcox 	/* Copy tags in several rounds */
2151366c37eSMatthew Wilcox //	printf("\ncopying tags...\n");
2161366c37eSMatthew Wilcox 	tmp = rand() % (count / 10 + 2);
217*268f42deSMatthew Wilcox 	tagged = tag_tagged_items(&tree, NULL, start, end, tmp, 0, 2);
218*268f42deSMatthew Wilcox 	assert(tagged == count);
2191366c37eSMatthew Wilcox 
2201366c37eSMatthew Wilcox //	printf("%lu %lu %lu\n", tagged, tmp, count);
2211366c37eSMatthew Wilcox //	printf("checking copied tags\n");
2221366c37eSMatthew Wilcox 	check_copied_tags(&tree, start, end, idx, ITEMS, 0, 2);
2231366c37eSMatthew Wilcox 	verify_tag_consistency(&tree, 0);
2241366c37eSMatthew Wilcox 	verify_tag_consistency(&tree, 1);
2251366c37eSMatthew Wilcox 	verify_tag_consistency(&tree, 2);
2261366c37eSMatthew Wilcox //	printf("\n");
2271366c37eSMatthew Wilcox 	item_kill_tree(&tree);
2281366c37eSMatthew Wilcox }
2291366c37eSMatthew Wilcox 
230eb73f7f3SRoss Zwisler static void __locate_check(struct radix_tree_root *tree, unsigned long index,
2310a2efc6cSMatthew Wilcox 			unsigned order)
232d42cb1a9SMatthew Wilcox {
233d42cb1a9SMatthew Wilcox 	struct item *item;
234d42cb1a9SMatthew Wilcox 	unsigned long index2;
235d42cb1a9SMatthew Wilcox 
2360a2efc6cSMatthew Wilcox 	item_insert_order(tree, index, order);
237d42cb1a9SMatthew Wilcox 	item = item_lookup(tree, index);
238478922e2SMatthew Wilcox 	index2 = find_item(tree, item);
239d42cb1a9SMatthew Wilcox 	if (index != index2) {
2400a2efc6cSMatthew Wilcox 		printf("index %ld order %d inserted; found %ld\n",
2410a2efc6cSMatthew Wilcox 			index, order, index2);
242d42cb1a9SMatthew Wilcox 		abort();
243d42cb1a9SMatthew Wilcox 	}
244d42cb1a9SMatthew Wilcox }
245d42cb1a9SMatthew Wilcox 
246eb73f7f3SRoss Zwisler static void __order_0_locate_check(void)
247eb73f7f3SRoss Zwisler {
248eb73f7f3SRoss Zwisler 	RADIX_TREE(tree, GFP_KERNEL);
249eb73f7f3SRoss Zwisler 	int i;
250eb73f7f3SRoss Zwisler 
251eb73f7f3SRoss Zwisler 	for (i = 0; i < 50; i++)
252eb73f7f3SRoss Zwisler 		__locate_check(&tree, rand() % INT_MAX, 0);
253eb73f7f3SRoss Zwisler 
254eb73f7f3SRoss Zwisler 	item_kill_tree(&tree);
255eb73f7f3SRoss Zwisler }
256eb73f7f3SRoss Zwisler 
257d42cb1a9SMatthew Wilcox static void locate_check(void)
258d42cb1a9SMatthew Wilcox {
259d42cb1a9SMatthew Wilcox 	RADIX_TREE(tree, GFP_KERNEL);
2600a2efc6cSMatthew Wilcox 	unsigned order;
261d42cb1a9SMatthew Wilcox 	unsigned long offset, index;
262d42cb1a9SMatthew Wilcox 
263eb73f7f3SRoss Zwisler 	__order_0_locate_check();
264eb73f7f3SRoss Zwisler 
2650a2efc6cSMatthew Wilcox 	for (order = 0; order < 20; order++) {
2660a2efc6cSMatthew Wilcox 		for (offset = 0; offset < (1 << (order + 3));
2670a2efc6cSMatthew Wilcox 		     offset += (1UL << order)) {
2680a2efc6cSMatthew Wilcox 			for (index = 0; index < (1UL << (order + 5));
2690a2efc6cSMatthew Wilcox 			     index += (1UL << order)) {
2700a2efc6cSMatthew Wilcox 				__locate_check(&tree, index + offset, order);
271d42cb1a9SMatthew Wilcox 			}
272478922e2SMatthew Wilcox 			if (find_item(&tree, &tree) != -1)
273d42cb1a9SMatthew Wilcox 				abort();
274d42cb1a9SMatthew Wilcox 
275d42cb1a9SMatthew Wilcox 			item_kill_tree(&tree);
276d42cb1a9SMatthew Wilcox 		}
2770a2efc6cSMatthew Wilcox 	}
278d42cb1a9SMatthew Wilcox 
279478922e2SMatthew Wilcox 	if (find_item(&tree, &tree) != -1)
280d42cb1a9SMatthew Wilcox 		abort();
2810a2efc6cSMatthew Wilcox 	__locate_check(&tree, -1, 0);
282478922e2SMatthew Wilcox 	if (find_item(&tree, &tree) != -1)
283d42cb1a9SMatthew Wilcox 		abort();
284d42cb1a9SMatthew Wilcox 	item_kill_tree(&tree);
285d42cb1a9SMatthew Wilcox }
286d42cb1a9SMatthew Wilcox 
287aa1d62d8SRoss Zwisler static void single_thread_tests(bool long_run)
2881366c37eSMatthew Wilcox {
2891366c37eSMatthew Wilcox 	int i;
2901366c37eSMatthew Wilcox 
291847d3576SMatthew Wilcox 	printf("starting single_thread_tests: %d allocated, preempt %d\n",
292847d3576SMatthew Wilcox 		nr_allocated, preempt_count);
2934f3755d1SMatthew Wilcox 	multiorder_checks();
294af1c5ccaSMatthew Wilcox 	rcu_barrier();
295847d3576SMatthew Wilcox 	printf("after multiorder_check: %d allocated, preempt %d\n",
296847d3576SMatthew Wilcox 		nr_allocated, preempt_count);
297d42cb1a9SMatthew Wilcox 	locate_check();
298af1c5ccaSMatthew Wilcox 	rcu_barrier();
299847d3576SMatthew Wilcox 	printf("after locate_check: %d allocated, preempt %d\n",
300847d3576SMatthew Wilcox 		nr_allocated, preempt_count);
3011366c37eSMatthew Wilcox 	tag_check();
302af1c5ccaSMatthew Wilcox 	rcu_barrier();
303847d3576SMatthew Wilcox 	printf("after tag_check: %d allocated, preempt %d\n",
304847d3576SMatthew Wilcox 		nr_allocated, preempt_count);
3051366c37eSMatthew Wilcox 	gang_check();
306af1c5ccaSMatthew Wilcox 	rcu_barrier();
307847d3576SMatthew Wilcox 	printf("after gang_check: %d allocated, preempt %d\n",
308847d3576SMatthew Wilcox 		nr_allocated, preempt_count);
3091366c37eSMatthew Wilcox 	add_and_check();
310af1c5ccaSMatthew Wilcox 	rcu_barrier();
311847d3576SMatthew Wilcox 	printf("after add_and_check: %d allocated, preempt %d\n",
312847d3576SMatthew Wilcox 		nr_allocated, preempt_count);
3131366c37eSMatthew Wilcox 	dynamic_height_check();
314af1c5ccaSMatthew Wilcox 	rcu_barrier();
315847d3576SMatthew Wilcox 	printf("after dynamic_height_check: %d allocated, preempt %d\n",
316847d3576SMatthew Wilcox 		nr_allocated, preempt_count);
317aa1d62d8SRoss Zwisler 	big_gang_check(long_run);
318af1c5ccaSMatthew Wilcox 	rcu_barrier();
319847d3576SMatthew Wilcox 	printf("after big_gang_check: %d allocated, preempt %d\n",
320847d3576SMatthew Wilcox 		nr_allocated, preempt_count);
321aa1d62d8SRoss Zwisler 	for (i = 0; i < (long_run ? 2000 : 3); i++) {
3221366c37eSMatthew Wilcox 		copy_tag_check();
3231366c37eSMatthew Wilcox 		printf("%d ", i);
3241366c37eSMatthew Wilcox 		fflush(stdout);
3251366c37eSMatthew Wilcox 	}
326af1c5ccaSMatthew Wilcox 	rcu_barrier();
327847d3576SMatthew Wilcox 	printf("after copy_tag_check: %d allocated, preempt %d\n",
328847d3576SMatthew Wilcox 		nr_allocated, preempt_count);
3291366c37eSMatthew Wilcox }
3301366c37eSMatthew Wilcox 
331aa1d62d8SRoss Zwisler int main(int argc, char **argv)
3321366c37eSMatthew Wilcox {
333aa1d62d8SRoss Zwisler 	bool long_run = false;
334aa1d62d8SRoss Zwisler 	int opt;
335061ef393SMatthew Wilcox 	unsigned int seed = time(NULL);
336aa1d62d8SRoss Zwisler 
337061ef393SMatthew Wilcox 	while ((opt = getopt(argc, argv, "ls:")) != -1) {
338aa1d62d8SRoss Zwisler 		if (opt == 'l')
339aa1d62d8SRoss Zwisler 			long_run = true;
340061ef393SMatthew Wilcox 		else if (opt == 's')
341061ef393SMatthew Wilcox 			seed = strtoul(optarg, NULL, 0);
342aa1d62d8SRoss Zwisler 	}
343aa1d62d8SRoss Zwisler 
344061ef393SMatthew Wilcox 	printf("random seed %u\n", seed);
345061ef393SMatthew Wilcox 	srand(seed);
346061ef393SMatthew Wilcox 
3471366c37eSMatthew Wilcox 	rcu_register_thread();
3481366c37eSMatthew Wilcox 	radix_tree_init();
3491366c37eSMatthew Wilcox 
3501366c37eSMatthew Wilcox 	regression1_test();
3511366c37eSMatthew Wilcox 	regression2_test();
3522d6f45b8SKonstantin Khlebnikov 	regression3_test();
353eec48525SRoss Zwisler 	iteration_test();
354aa1d62d8SRoss Zwisler 	single_thread_tests(long_run);
3551366c37eSMatthew Wilcox 
3566df5ee78SMatthew Wilcox 	/* Free any remaining preallocated nodes */
3576df5ee78SMatthew Wilcox 	radix_tree_cpu_dead(0);
3586df5ee78SMatthew Wilcox 
359cfa40bcfSKonstantin Khlebnikov 	benchmark();
360cfa40bcfSKonstantin Khlebnikov 
361af1c5ccaSMatthew Wilcox 	rcu_barrier();
362af1c5ccaSMatthew Wilcox 	printf("after rcu_barrier: %d allocated, preempt %d\n",
363847d3576SMatthew Wilcox 		nr_allocated, preempt_count);
3641366c37eSMatthew Wilcox 	rcu_unregister_thread();
3651366c37eSMatthew Wilcox 
3661366c37eSMatthew Wilcox 	exit(0);
3671366c37eSMatthew Wilcox }
368