tools/testing/radix-tree/maple.c

Source file repositories/reference/linux-study-clean/tools/testing/radix-tree/maple.c

File Facts

System
Linux kernel
Corpus path
tools/testing/radix-tree/maple.c
Extension
.c
Size
1386933 bytes
Lines
36518
Domain
Support Tooling And Documentation
Bucket
tools
Inferred role
Support Tooling And Documentation: exported/initcall integration point
Status
integration implementation candidate

Why This File Exists

Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.

Dependency Surface

Detected Declarations

Annotated Snippet

#define module_init(x)
#define module_exit(x)
#define MODULE_AUTHOR(x)
#define MODULE_DESCRIPTION(X)
#define MODULE_LICENSE(x)
#define dump_stack()	assert(0)

#include "test.h"

#include "../shared/maple-shim.c"
#include "../../../lib/test_maple_tree.c"

#define RCU_RANGE_COUNT 1000
#define RCU_MT_BUG_ON(test, y) {if (y) { test->stop = true; } MT_BUG_ON(test->mt, y); }

struct rcu_test_struct2 {
	struct maple_tree *mt;

	bool start;
	bool stop;
	unsigned int thread_count;

	unsigned int seen_toggle;
	unsigned int seen_added;
	unsigned int seen_modified;
	unsigned int seen_deleted;
	int pause;

	unsigned long index[RCU_RANGE_COUNT];
	unsigned long last[RCU_RANGE_COUNT];
	pthread_mutex_t dump;
};

struct rcu_test_struct3 {
	struct maple_tree *mt;
	unsigned long index;
	unsigned long last;
	bool stop;
};

struct rcu_reader_struct {
	unsigned int id;
	int mod;
	int del;
	int flip;
	int add;
	int next;
	struct rcu_test_struct2 *test;
};

/*
 * Check erasing including RCU.
 */
static noinline void __init check_erase(struct maple_tree *mt, unsigned long index,
		void *ptr)
{
	MT_BUG_ON(mt, mtree_test_erase(mt, index) != ptr);
}

#define erase_check_load(mt, i) check_load(mt, set[i], entry[i%2])
#define erase_check_insert(mt, i) check_insert(mt, set[i], entry[i%2])
#define erase_check_erase(mt, i) check_erase(mt, set[i], entry[i%2])

static noinline void __init check_erase_testset(struct maple_tree *mt)
{
	static const unsigned long set[] = { 5015, 5014, 5017, 25, 1000,
					     1001, 1002, 1003, 1005, 0,
					     6003, 6002, 6008, 6012, 6015,
					     7003, 7002, 7008, 7012, 7015,
					     8003, 8002, 8008, 8012, 8015,
					     9003, 9002, 9008, 9012, 9015,
					     10003, 10002, 10008, 10012, 10015,
					     11003, 11002, 11008, 11012, 11015,
					     12003, 12002, 12008, 12012, 12015,
					     13003, 13002, 13008, 13012, 13015,
					     14003, 14002, 14008, 14012, 14015,
					     15003, 15002, 15008, 15012, 15015,
					   };


	void *ptr = &check_erase_testset;
	void *entry[2] = { ptr, mt };
	void *root_node;


	rcu_register_thread();
	mt_set_in_rcu(mt);
	for (int i = 0; i < 4; i++)
		erase_check_insert(mt, i);
	for (int i = 0; i < 4; i++)

Annotation

Implementation Notes