aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/radix-tree/iteration_check.c
diff options
context:
space:
mode:
authorMatthew Wilcox <willy@infradead.org>2018-08-18 07:09:22 -0400
committerMatthew Wilcox <willy@infradead.org>2018-10-21 10:46:45 -0400
commit372266ba0267803564824b1c09f1bb7f3f3fc761 (patch)
treee0f2551f5b51b793afe4fe7edfcaf5da6fce974d /tools/testing/radix-tree/iteration_check.c
parentadb9d9c4ccb1ff0bf1d376e65f36aa5573c75c1a (diff)
radix tree test suite: Convert tag_tagged_items to XArray
The tag_tagged_items() function is supposed to test the page-writeback tagging code. Since that has been converted to the XArray, there's not much point in testing the radix tree's tagging code. This requires using the pthread mutex embedded in the xarray instead of an external lock, so remove the pthread mutexes which protect xarrays/radix trees. Also remove radix_tree_iter_tag_set() as this was the last user. Signed-off-by: Matthew Wilcox <willy@infradead.org>
Diffstat (limited to 'tools/testing/radix-tree/iteration_check.c')
-rw-r--r--tools/testing/radix-tree/iteration_check.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/tools/testing/radix-tree/iteration_check.c b/tools/testing/radix-tree/iteration_check.c
index a92bab513701..d047327bb9ef 100644
--- a/tools/testing/radix-tree/iteration_check.c
+++ b/tools/testing/radix-tree/iteration_check.c
@@ -18,10 +18,9 @@
18 18
19#define NUM_THREADS 5 19#define NUM_THREADS 5
20#define MAX_IDX 100 20#define MAX_IDX 100
21#define TAG 0 21#define TAG XA_MARK_0
22#define NEW_TAG 1 22#define NEW_TAG XA_MARK_1
23 23
24static pthread_mutex_t tree_lock = PTHREAD_MUTEX_INITIALIZER;
25static pthread_t threads[NUM_THREADS]; 24static pthread_t threads[NUM_THREADS];
26static unsigned int seeds[3]; 25static unsigned int seeds[3];
27static RADIX_TREE(tree, GFP_KERNEL); 26static RADIX_TREE(tree, GFP_KERNEL);
@@ -38,7 +37,7 @@ static void *add_entries_fn(void *arg)
38 int order; 37 int order;
39 38
40 for (pgoff = 0; pgoff < MAX_IDX; pgoff++) { 39 for (pgoff = 0; pgoff < MAX_IDX; pgoff++) {
41 pthread_mutex_lock(&tree_lock); 40 xa_lock(&tree);
42 for (order = max_order; order >= 0; order--) { 41 for (order = max_order; order >= 0; order--) {
43 if (item_insert_order(&tree, pgoff, order) 42 if (item_insert_order(&tree, pgoff, order)
44 == 0) { 43 == 0) {
@@ -46,7 +45,7 @@ static void *add_entries_fn(void *arg)
46 break; 45 break;
47 } 46 }
48 } 47 }
49 pthread_mutex_unlock(&tree_lock); 48 xa_unlock(&tree);
50 } 49 }
51 } 50 }
52 51
@@ -150,9 +149,9 @@ static void *remove_entries_fn(void *arg)
150 149
151 pgoff = rand_r(&seeds[2]) % MAX_IDX; 150 pgoff = rand_r(&seeds[2]) % MAX_IDX;
152 151
153 pthread_mutex_lock(&tree_lock); 152 xa_lock(&tree);
154 item_delete(&tree, pgoff); 153 item_delete(&tree, pgoff);
155 pthread_mutex_unlock(&tree_lock); 154 xa_unlock(&tree);
156 } 155 }
157 156
158 rcu_unregister_thread(); 157 rcu_unregister_thread();
@@ -165,8 +164,7 @@ static void *tag_entries_fn(void *arg)
165 rcu_register_thread(); 164 rcu_register_thread();
166 165
167 while (!test_complete) { 166 while (!test_complete) {
168 tag_tagged_items(&tree, &tree_lock, 0, MAX_IDX, 10, TAG, 167 tag_tagged_items(&tree, 0, MAX_IDX, 10, TAG, NEW_TAG);
169 NEW_TAG);
170 } 168 }
171 rcu_unregister_thread(); 169 rcu_unregister_thread();
172 return NULL; 170 return NULL;