1b2441318SGreg Kroah-Hartman // SPDX-License-Identifier: GPL-2.0
21366c37eSMatthew Wilcox #include <stdlib.h>
31366c37eSMatthew Wilcox #include <assert.h>
41366c37eSMatthew Wilcox #include <stdio.h>
51366c37eSMatthew Wilcox #include <string.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 
121366c37eSMatthew Wilcox 
131366c37eSMatthew Wilcox static void
__simple_checks(struct radix_tree_root * tree,unsigned long index,int tag)141366c37eSMatthew Wilcox __simple_checks(struct radix_tree_root *tree, unsigned long index, int tag)
151366c37eSMatthew Wilcox {
16070c5ac2SMatthew Wilcox 	unsigned long first = 0;
171366c37eSMatthew Wilcox 	int ret;
181366c37eSMatthew Wilcox 
191366c37eSMatthew Wilcox 	item_check_absent(tree, index);
201366c37eSMatthew Wilcox 	assert(item_tag_get(tree, index, tag) == 0);
211366c37eSMatthew Wilcox 
221366c37eSMatthew Wilcox 	item_insert(tree, index);
231366c37eSMatthew Wilcox 	assert(item_tag_get(tree, index, tag) == 0);
241366c37eSMatthew Wilcox 	item_tag_set(tree, index, tag);
251366c37eSMatthew Wilcox 	ret = item_tag_get(tree, index, tag);
261366c37eSMatthew Wilcox 	assert(ret != 0);
27372266baSMatthew Wilcox 	ret = tag_tagged_items(tree, first, ~0UL, 10, tag, !tag);
28070c5ac2SMatthew Wilcox 	assert(ret == 1);
29070c5ac2SMatthew Wilcox 	ret = item_tag_get(tree, index, !tag);
30070c5ac2SMatthew Wilcox 	assert(ret != 0);
311366c37eSMatthew Wilcox 	ret = item_delete(tree, index);
321366c37eSMatthew Wilcox 	assert(ret != 0);
331366c37eSMatthew Wilcox 	item_insert(tree, index);
341366c37eSMatthew Wilcox 	ret = item_tag_get(tree, index, tag);
351366c37eSMatthew Wilcox 	assert(ret == 0);
361366c37eSMatthew Wilcox 	ret = item_delete(tree, index);
371366c37eSMatthew Wilcox 	assert(ret != 0);
381366c37eSMatthew Wilcox 	ret = item_delete(tree, index);
391366c37eSMatthew Wilcox 	assert(ret == 0);
401366c37eSMatthew Wilcox }
411366c37eSMatthew Wilcox 
simple_checks(void)421366c37eSMatthew Wilcox void simple_checks(void)
431366c37eSMatthew Wilcox {
441366c37eSMatthew Wilcox 	unsigned long index;
451366c37eSMatthew Wilcox 	RADIX_TREE(tree, GFP_KERNEL);
461366c37eSMatthew Wilcox 
471366c37eSMatthew Wilcox 	for (index = 0; index < 10000; index++) {
481366c37eSMatthew Wilcox 		__simple_checks(&tree, index, 0);
491366c37eSMatthew Wilcox 		__simple_checks(&tree, index, 1);
501366c37eSMatthew Wilcox 	}
511366c37eSMatthew Wilcox 	verify_tag_consistency(&tree, 0);
521366c37eSMatthew Wilcox 	verify_tag_consistency(&tree, 1);
5373bc029bSRehas Sachdeva 	printv(2, "before item_kill_tree: %d allocated\n", nr_allocated);
541366c37eSMatthew Wilcox 	item_kill_tree(&tree);
55af1c5ccaSMatthew Wilcox 	rcu_barrier();
5673bc029bSRehas Sachdeva 	printv(2, "after item_kill_tree: %d allocated\n", nr_allocated);
571366c37eSMatthew Wilcox }
581366c37eSMatthew Wilcox 
591366c37eSMatthew Wilcox /*
601366c37eSMatthew Wilcox  * Check that tags propagate correctly when extending a tree.
611366c37eSMatthew Wilcox  */
extend_checks(void)621366c37eSMatthew Wilcox static void extend_checks(void)
631366c37eSMatthew Wilcox {
641366c37eSMatthew Wilcox 	RADIX_TREE(tree, GFP_KERNEL);
651366c37eSMatthew Wilcox 
661366c37eSMatthew Wilcox 	item_insert(&tree, 43);
671366c37eSMatthew Wilcox 	assert(item_tag_get(&tree, 43, 0) == 0);
681366c37eSMatthew Wilcox 	item_tag_set(&tree, 43, 0);
691366c37eSMatthew Wilcox 	assert(item_tag_get(&tree, 43, 0) == 1);
701366c37eSMatthew Wilcox 	item_insert(&tree, 1000000);
711366c37eSMatthew Wilcox 	assert(item_tag_get(&tree, 43, 0) == 1);
721366c37eSMatthew Wilcox 
731366c37eSMatthew Wilcox 	item_insert(&tree, 0);
741366c37eSMatthew Wilcox 	item_tag_set(&tree, 0, 0);
751366c37eSMatthew Wilcox 	item_delete(&tree, 1000000);
761366c37eSMatthew Wilcox 	assert(item_tag_get(&tree, 43, 0) != 0);
771366c37eSMatthew Wilcox 	item_delete(&tree, 43);
781366c37eSMatthew Wilcox 	assert(item_tag_get(&tree, 43, 0) == 0);	/* crash */
791366c37eSMatthew Wilcox 	assert(item_tag_get(&tree, 0, 0) == 1);
801366c37eSMatthew Wilcox 
811366c37eSMatthew Wilcox 	verify_tag_consistency(&tree, 0);
821366c37eSMatthew Wilcox 
831366c37eSMatthew Wilcox 	item_kill_tree(&tree);
841366c37eSMatthew Wilcox }
851366c37eSMatthew Wilcox 
861366c37eSMatthew Wilcox /*
871366c37eSMatthew Wilcox  * Check that tags propagate correctly when contracting a tree.
881366c37eSMatthew Wilcox  */
contract_checks(void)891366c37eSMatthew Wilcox static void contract_checks(void)
901366c37eSMatthew Wilcox {
911366c37eSMatthew Wilcox 	struct item *item;
921366c37eSMatthew Wilcox 	int tmp;
931366c37eSMatthew Wilcox 	RADIX_TREE(tree, GFP_KERNEL);
941366c37eSMatthew Wilcox 
951366c37eSMatthew Wilcox 	tmp = 1<<RADIX_TREE_MAP_SHIFT;
961366c37eSMatthew Wilcox 	item_insert(&tree, tmp);
971366c37eSMatthew Wilcox 	item_insert(&tree, tmp+1);
981366c37eSMatthew Wilcox 	item_tag_set(&tree, tmp, 0);
991366c37eSMatthew Wilcox 	item_tag_set(&tree, tmp, 1);
1001366c37eSMatthew Wilcox 	item_tag_set(&tree, tmp+1, 0);
1011366c37eSMatthew Wilcox 	item_delete(&tree, tmp+1);
1021366c37eSMatthew Wilcox 	item_tag_clear(&tree, tmp, 1);
1031366c37eSMatthew Wilcox 
1041366c37eSMatthew Wilcox 	assert(radix_tree_gang_lookup_tag(&tree, (void **)&item, 0, 1, 0) == 1);
1051366c37eSMatthew Wilcox 	assert(radix_tree_gang_lookup_tag(&tree, (void **)&item, 0, 1, 1) == 0);
1061366c37eSMatthew Wilcox 
1071366c37eSMatthew Wilcox 	assert(item_tag_get(&tree, tmp, 0) == 1);
1081366c37eSMatthew Wilcox 	assert(item_tag_get(&tree, tmp, 1) == 0);
1091366c37eSMatthew Wilcox 
1101366c37eSMatthew Wilcox 	verify_tag_consistency(&tree, 0);
1111366c37eSMatthew Wilcox 	item_kill_tree(&tree);
1121366c37eSMatthew Wilcox }
1131366c37eSMatthew Wilcox 
1141366c37eSMatthew Wilcox /*
1151366c37eSMatthew Wilcox  * Stupid tag thrasher
1161366c37eSMatthew Wilcox  *
1171366c37eSMatthew Wilcox  * Create a large linear array corresponding to the tree.   Each element in
1181366c37eSMatthew Wilcox  * the array is coherent with each node in the tree
1191366c37eSMatthew Wilcox  */
1201366c37eSMatthew Wilcox 
1211366c37eSMatthew Wilcox enum {
1221366c37eSMatthew Wilcox 	NODE_ABSENT = 0,
1231366c37eSMatthew Wilcox 	NODE_PRESENT = 1,
1241366c37eSMatthew Wilcox 	NODE_TAGGED = 2,
1251366c37eSMatthew Wilcox };
1261366c37eSMatthew Wilcox 
127b301aac5SDan Carpenter #define THRASH_SIZE		(1000 * 1000)
1281366c37eSMatthew Wilcox #define N 127
1291366c37eSMatthew Wilcox #define BATCH	33
1301366c37eSMatthew Wilcox 
gang_check(struct radix_tree_root * tree,char * thrash_state,int tag)1311366c37eSMatthew Wilcox static void gang_check(struct radix_tree_root *tree,
1321366c37eSMatthew Wilcox 			char *thrash_state, int tag)
1331366c37eSMatthew Wilcox {
1341366c37eSMatthew Wilcox 	struct item *items[BATCH];
1351366c37eSMatthew Wilcox 	int nr_found;
1361366c37eSMatthew Wilcox 	unsigned long index = 0;
1371366c37eSMatthew Wilcox 	unsigned long last_index = 0;
1381366c37eSMatthew Wilcox 
1391366c37eSMatthew Wilcox 	while ((nr_found = radix_tree_gang_lookup_tag(tree, (void **)items,
1401366c37eSMatthew Wilcox 					index, BATCH, tag))) {
1411366c37eSMatthew Wilcox 		int i;
1421366c37eSMatthew Wilcox 
1431366c37eSMatthew Wilcox 		for (i = 0; i < nr_found; i++) {
1441366c37eSMatthew Wilcox 			struct item *item = items[i];
1451366c37eSMatthew Wilcox 
1461366c37eSMatthew Wilcox 			while (last_index < item->index) {
1471366c37eSMatthew Wilcox 				assert(thrash_state[last_index] != NODE_TAGGED);
1481366c37eSMatthew Wilcox 				last_index++;
1491366c37eSMatthew Wilcox 			}
1501366c37eSMatthew Wilcox 			assert(thrash_state[last_index] == NODE_TAGGED);
1511366c37eSMatthew Wilcox 			last_index++;
1521366c37eSMatthew Wilcox 		}
1531366c37eSMatthew Wilcox 		index = items[nr_found - 1]->index + 1;
1541366c37eSMatthew Wilcox 	}
1551366c37eSMatthew Wilcox }
1561366c37eSMatthew Wilcox 
do_thrash(struct radix_tree_root * tree,char * thrash_state,int tag)1571366c37eSMatthew Wilcox static void do_thrash(struct radix_tree_root *tree, char *thrash_state, int tag)
1581366c37eSMatthew Wilcox {
1591366c37eSMatthew Wilcox 	int insert_chunk;
1601366c37eSMatthew Wilcox 	int delete_chunk;
1611366c37eSMatthew Wilcox 	int tag_chunk;
1621366c37eSMatthew Wilcox 	int untag_chunk;
1631366c37eSMatthew Wilcox 	int total_tagged = 0;
1641366c37eSMatthew Wilcox 	int total_present = 0;
1651366c37eSMatthew Wilcox 
1661366c37eSMatthew Wilcox 	for (insert_chunk = 1; insert_chunk < THRASH_SIZE; insert_chunk *= N)
1671366c37eSMatthew Wilcox 	for (delete_chunk = 1; delete_chunk < THRASH_SIZE; delete_chunk *= N)
1681366c37eSMatthew Wilcox 	for (tag_chunk = 1; tag_chunk < THRASH_SIZE; tag_chunk *= N)
1691366c37eSMatthew Wilcox 	for (untag_chunk = 1; untag_chunk < THRASH_SIZE; untag_chunk *= N) {
1701366c37eSMatthew Wilcox 		int i;
1711366c37eSMatthew Wilcox 		unsigned long index;
1721366c37eSMatthew Wilcox 		int nr_inserted = 0;
1731366c37eSMatthew Wilcox 		int nr_deleted = 0;
1741366c37eSMatthew Wilcox 		int nr_tagged = 0;
1751366c37eSMatthew Wilcox 		int nr_untagged = 0;
1761366c37eSMatthew Wilcox 		int actual_total_tagged;
1771366c37eSMatthew Wilcox 		int actual_total_present;
1781366c37eSMatthew Wilcox 
1791366c37eSMatthew Wilcox 		for (i = 0; i < insert_chunk; i++) {
1801366c37eSMatthew Wilcox 			index = rand() % THRASH_SIZE;
1811366c37eSMatthew Wilcox 			if (thrash_state[index] != NODE_ABSENT)
1821366c37eSMatthew Wilcox 				continue;
1831366c37eSMatthew Wilcox 			item_check_absent(tree, index);
1841366c37eSMatthew Wilcox 			item_insert(tree, index);
1851366c37eSMatthew Wilcox 			assert(thrash_state[index] != NODE_PRESENT);
1861366c37eSMatthew Wilcox 			thrash_state[index] = NODE_PRESENT;
1871366c37eSMatthew Wilcox 			nr_inserted++;
1881366c37eSMatthew Wilcox 			total_present++;
1891366c37eSMatthew Wilcox 		}
1901366c37eSMatthew Wilcox 
1911366c37eSMatthew Wilcox 		for (i = 0; i < delete_chunk; i++) {
1921366c37eSMatthew Wilcox 			index = rand() % THRASH_SIZE;
1931366c37eSMatthew Wilcox 			if (thrash_state[index] == NODE_ABSENT)
1941366c37eSMatthew Wilcox 				continue;
1951366c37eSMatthew Wilcox 			item_check_present(tree, index);
1961366c37eSMatthew Wilcox 			if (item_tag_get(tree, index, tag)) {
1971366c37eSMatthew Wilcox 				assert(thrash_state[index] == NODE_TAGGED);
1981366c37eSMatthew Wilcox 				total_tagged--;
1991366c37eSMatthew Wilcox 			} else {
2001366c37eSMatthew Wilcox 				assert(thrash_state[index] == NODE_PRESENT);
2011366c37eSMatthew Wilcox 			}
2021366c37eSMatthew Wilcox 			item_delete(tree, index);
2031366c37eSMatthew Wilcox 			assert(thrash_state[index] != NODE_ABSENT);
2041366c37eSMatthew Wilcox 			thrash_state[index] = NODE_ABSENT;
2051366c37eSMatthew Wilcox 			nr_deleted++;
2061366c37eSMatthew Wilcox 			total_present--;
2071366c37eSMatthew Wilcox 		}
2081366c37eSMatthew Wilcox 
2091366c37eSMatthew Wilcox 		for (i = 0; i < tag_chunk; i++) {
2101366c37eSMatthew Wilcox 			index = rand() % THRASH_SIZE;
2111366c37eSMatthew Wilcox 			if (thrash_state[index] != NODE_PRESENT) {
2121366c37eSMatthew Wilcox 				if (item_lookup(tree, index))
2131366c37eSMatthew Wilcox 					assert(item_tag_get(tree, index, tag));
2141366c37eSMatthew Wilcox 				continue;
2151366c37eSMatthew Wilcox 			}
2161366c37eSMatthew Wilcox 			item_tag_set(tree, index, tag);
2171366c37eSMatthew Wilcox 			item_tag_set(tree, index, tag);
2181366c37eSMatthew Wilcox 			assert(thrash_state[index] != NODE_TAGGED);
2191366c37eSMatthew Wilcox 			thrash_state[index] = NODE_TAGGED;
2201366c37eSMatthew Wilcox 			nr_tagged++;
2211366c37eSMatthew Wilcox 			total_tagged++;
2221366c37eSMatthew Wilcox 		}
2231366c37eSMatthew Wilcox 
2241366c37eSMatthew Wilcox 		for (i = 0; i < untag_chunk; i++) {
2251366c37eSMatthew Wilcox 			index = rand() % THRASH_SIZE;
2261366c37eSMatthew Wilcox 			if (thrash_state[index] != NODE_TAGGED)
2271366c37eSMatthew Wilcox 				continue;
2281366c37eSMatthew Wilcox 			item_check_present(tree, index);
2291366c37eSMatthew Wilcox 			assert(item_tag_get(tree, index, tag));
2301366c37eSMatthew Wilcox 			item_tag_clear(tree, index, tag);
2311366c37eSMatthew Wilcox 			item_tag_clear(tree, index, tag);
2321366c37eSMatthew Wilcox 			assert(thrash_state[index] != NODE_PRESENT);
2331366c37eSMatthew Wilcox 			thrash_state[index] = NODE_PRESENT;
2341366c37eSMatthew Wilcox 			nr_untagged++;
2351366c37eSMatthew Wilcox 			total_tagged--;
2361366c37eSMatthew Wilcox 		}
2371366c37eSMatthew Wilcox 
2381366c37eSMatthew Wilcox 		actual_total_tagged = 0;
2391366c37eSMatthew Wilcox 		actual_total_present = 0;
2401366c37eSMatthew Wilcox 		for (index = 0; index < THRASH_SIZE; index++) {
2411366c37eSMatthew Wilcox 			switch (thrash_state[index]) {
2421366c37eSMatthew Wilcox 			case NODE_ABSENT:
2431366c37eSMatthew Wilcox 				item_check_absent(tree, index);
2441366c37eSMatthew Wilcox 				break;
2451366c37eSMatthew Wilcox 			case NODE_PRESENT:
2461366c37eSMatthew Wilcox 				item_check_present(tree, index);
2471366c37eSMatthew Wilcox 				assert(!item_tag_get(tree, index, tag));
2481366c37eSMatthew Wilcox 				actual_total_present++;
2491366c37eSMatthew Wilcox 				break;
2501366c37eSMatthew Wilcox 			case NODE_TAGGED:
2511366c37eSMatthew Wilcox 				item_check_present(tree, index);
2521366c37eSMatthew Wilcox 				assert(item_tag_get(tree, index, tag));
2531366c37eSMatthew Wilcox 				actual_total_present++;
2541366c37eSMatthew Wilcox 				actual_total_tagged++;
2551366c37eSMatthew Wilcox 				break;
2561366c37eSMatthew Wilcox 			}
2571366c37eSMatthew Wilcox 		}
2581366c37eSMatthew Wilcox 
2591366c37eSMatthew Wilcox 		gang_check(tree, thrash_state, tag);
2601366c37eSMatthew Wilcox 
26173bc029bSRehas Sachdeva 		printv(2, "%d(%d) %d(%d) %d(%d) %d(%d) / "
2621366c37eSMatthew Wilcox 				"%d(%d) present, %d(%d) tagged\n",
2631366c37eSMatthew Wilcox 			insert_chunk, nr_inserted,
2641366c37eSMatthew Wilcox 			delete_chunk, nr_deleted,
2651366c37eSMatthew Wilcox 			tag_chunk, nr_tagged,
2661366c37eSMatthew Wilcox 			untag_chunk, nr_untagged,
2671366c37eSMatthew Wilcox 			total_present, actual_total_present,
2681366c37eSMatthew Wilcox 			total_tagged, actual_total_tagged);
2691366c37eSMatthew Wilcox 	}
2701366c37eSMatthew Wilcox }
2711366c37eSMatthew Wilcox 
thrash_tags(void)2721366c37eSMatthew Wilcox static void thrash_tags(void)
2731366c37eSMatthew Wilcox {
2741366c37eSMatthew Wilcox 	RADIX_TREE(tree, GFP_KERNEL);
2751366c37eSMatthew Wilcox 	char *thrash_state;
2761366c37eSMatthew Wilcox 
2771366c37eSMatthew Wilcox 	thrash_state = malloc(THRASH_SIZE);
2781366c37eSMatthew Wilcox 	memset(thrash_state, 0, THRASH_SIZE);
2791366c37eSMatthew Wilcox 
2801366c37eSMatthew Wilcox 	do_thrash(&tree, thrash_state, 0);
2811366c37eSMatthew Wilcox 
2821366c37eSMatthew Wilcox 	verify_tag_consistency(&tree, 0);
2831366c37eSMatthew Wilcox 	item_kill_tree(&tree);
2841366c37eSMatthew Wilcox 	free(thrash_state);
2851366c37eSMatthew Wilcox }
2861366c37eSMatthew Wilcox 
leak_check(void)2871366c37eSMatthew Wilcox static void leak_check(void)
2881366c37eSMatthew Wilcox {
2891366c37eSMatthew Wilcox 	RADIX_TREE(tree, GFP_KERNEL);
2901366c37eSMatthew Wilcox 
2911366c37eSMatthew Wilcox 	item_insert(&tree, 1000000);
2921366c37eSMatthew Wilcox 	item_delete(&tree, 1000000);
2931366c37eSMatthew Wilcox 	item_kill_tree(&tree);
2941366c37eSMatthew Wilcox }
2951366c37eSMatthew Wilcox 
__leak_check(void)2961366c37eSMatthew Wilcox static void __leak_check(void)
2971366c37eSMatthew Wilcox {
2981366c37eSMatthew Wilcox 	RADIX_TREE(tree, GFP_KERNEL);
2991366c37eSMatthew Wilcox 
30073bc029bSRehas Sachdeva 	printv(2, "%d: nr_allocated=%d\n", __LINE__, nr_allocated);
3011366c37eSMatthew Wilcox 	item_insert(&tree, 1000000);
30273bc029bSRehas Sachdeva 	printv(2, "%d: nr_allocated=%d\n", __LINE__, nr_allocated);
3031366c37eSMatthew Wilcox 	item_delete(&tree, 1000000);
30473bc029bSRehas Sachdeva 	printv(2, "%d: nr_allocated=%d\n", __LINE__, nr_allocated);
3051366c37eSMatthew Wilcox 	item_kill_tree(&tree);
30673bc029bSRehas Sachdeva 	printv(2, "%d: nr_allocated=%d\n", __LINE__, nr_allocated);
3071366c37eSMatthew Wilcox }
3081366c37eSMatthew Wilcox 
single_check(void)3091366c37eSMatthew Wilcox static void single_check(void)
3101366c37eSMatthew Wilcox {
3111366c37eSMatthew Wilcox 	struct item *items[BATCH];
3121366c37eSMatthew Wilcox 	RADIX_TREE(tree, GFP_KERNEL);
3131366c37eSMatthew Wilcox 	int ret;
314070c5ac2SMatthew Wilcox 	unsigned long first = 0;
3151366c37eSMatthew Wilcox 
3161366c37eSMatthew Wilcox 	item_insert(&tree, 0);
3171366c37eSMatthew Wilcox 	item_tag_set(&tree, 0, 0);
3181366c37eSMatthew Wilcox 	ret = radix_tree_gang_lookup_tag(&tree, (void **)items, 0, BATCH, 0);
3191366c37eSMatthew Wilcox 	assert(ret == 1);
3201366c37eSMatthew Wilcox 	ret = radix_tree_gang_lookup_tag(&tree, (void **)items, 1, BATCH, 0);
3211366c37eSMatthew Wilcox 	assert(ret == 0);
3221366c37eSMatthew Wilcox 	verify_tag_consistency(&tree, 0);
3231366c37eSMatthew Wilcox 	verify_tag_consistency(&tree, 1);
324372266baSMatthew Wilcox 	ret = tag_tagged_items(&tree, first, 10, 10, XA_MARK_0, XA_MARK_1);
325070c5ac2SMatthew Wilcox 	assert(ret == 1);
326070c5ac2SMatthew Wilcox 	ret = radix_tree_gang_lookup_tag(&tree, (void **)items, 0, BATCH, 1);
327070c5ac2SMatthew Wilcox 	assert(ret == 1);
328092bc0b2SMatthew Wilcox 	item_tag_clear(&tree, 0, 0);
329092bc0b2SMatthew Wilcox 	ret = radix_tree_gang_lookup_tag(&tree, (void **)items, 0, BATCH, 0);
330092bc0b2SMatthew Wilcox 	assert(ret == 0);
3311366c37eSMatthew Wilcox 	item_kill_tree(&tree);
3321366c37eSMatthew Wilcox }
3331366c37eSMatthew Wilcox 
tag_check(void)3341366c37eSMatthew Wilcox void tag_check(void)
3351366c37eSMatthew Wilcox {
3361366c37eSMatthew Wilcox 	single_check();
3371366c37eSMatthew Wilcox 	extend_checks();
3381366c37eSMatthew Wilcox 	contract_checks();
339af1c5ccaSMatthew Wilcox 	rcu_barrier();
34073bc029bSRehas Sachdeva 	printv(2, "after extend_checks: %d allocated\n", nr_allocated);
3411366c37eSMatthew Wilcox 	__leak_check();
3421366c37eSMatthew Wilcox 	leak_check();
343af1c5ccaSMatthew Wilcox 	rcu_barrier();
34473bc029bSRehas Sachdeva 	printv(2, "after leak_check: %d allocated\n", nr_allocated);
3451366c37eSMatthew Wilcox 	simple_checks();
346af1c5ccaSMatthew Wilcox 	rcu_barrier();
34773bc029bSRehas Sachdeva 	printv(2, "after simple_checks: %d allocated\n", nr_allocated);
3481366c37eSMatthew Wilcox 	thrash_tags();
349af1c5ccaSMatthew Wilcox 	rcu_barrier();
35073bc029bSRehas Sachdeva 	printv(2, "after thrash_tags: %d allocated\n", nr_allocated);
3511366c37eSMatthew Wilcox }
352