aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/radix-tree/regression1.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/regression1.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/regression1.c')
-rw-r--r--tools/testing/radix-tree/regression1.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/tools/testing/radix-tree/regression1.c b/tools/testing/radix-tree/regression1.c
index b4a4a7168986..a61c7bcbc72d 100644
--- a/tools/testing/radix-tree/regression1.c
+++ b/tools/testing/radix-tree/regression1.c
@@ -44,7 +44,6 @@
44#include "regression.h" 44#include "regression.h"
45 45
46static RADIX_TREE(mt_tree, GFP_KERNEL); 46static RADIX_TREE(mt_tree, GFP_KERNEL);
47static pthread_mutex_t mt_lock = PTHREAD_MUTEX_INITIALIZER;
48 47
49struct page { 48struct page {
50 pthread_mutex_t lock; 49 pthread_mutex_t lock;
@@ -126,29 +125,29 @@ static void *regression1_fn(void *arg)
126 struct page *p; 125 struct page *p;
127 126
128 p = page_alloc(0); 127 p = page_alloc(0);
129 pthread_mutex_lock(&mt_lock); 128 xa_lock(&mt_tree);
130 radix_tree_insert(&mt_tree, 0, p); 129 radix_tree_insert(&mt_tree, 0, p);
131 pthread_mutex_unlock(&mt_lock); 130 xa_unlock(&mt_tree);
132 131
133 p = page_alloc(1); 132 p = page_alloc(1);
134 pthread_mutex_lock(&mt_lock); 133 xa_lock(&mt_tree);
135 radix_tree_insert(&mt_tree, 1, p); 134 radix_tree_insert(&mt_tree, 1, p);
136 pthread_mutex_unlock(&mt_lock); 135 xa_unlock(&mt_tree);
137 136
138 pthread_mutex_lock(&mt_lock); 137 xa_lock(&mt_tree);
139 p = radix_tree_delete(&mt_tree, 1); 138 p = radix_tree_delete(&mt_tree, 1);
140 pthread_mutex_lock(&p->lock); 139 pthread_mutex_lock(&p->lock);
141 p->count--; 140 p->count--;
142 pthread_mutex_unlock(&p->lock); 141 pthread_mutex_unlock(&p->lock);
143 pthread_mutex_unlock(&mt_lock); 142 xa_unlock(&mt_tree);
144 page_free(p); 143 page_free(p);
145 144
146 pthread_mutex_lock(&mt_lock); 145 xa_lock(&mt_tree);
147 p = radix_tree_delete(&mt_tree, 0); 146 p = radix_tree_delete(&mt_tree, 0);
148 pthread_mutex_lock(&p->lock); 147 pthread_mutex_lock(&p->lock);
149 p->count--; 148 p->count--;
150 pthread_mutex_unlock(&p->lock); 149 pthread_mutex_unlock(&p->lock);
151 pthread_mutex_unlock(&mt_lock); 150 xa_unlock(&mt_tree);
152 page_free(p); 151 page_free(p);
153 } 152 }
154 } else { 153 } else {