diff options
Diffstat (limited to 'tools/testing/radix-tree/iteration_check.c')
-rw-r--r-- | tools/testing/radix-tree/iteration_check.c | 16 |
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 | ||
24 | static pthread_mutex_t tree_lock = PTHREAD_MUTEX_INITIALIZER; | ||
25 | static pthread_t threads[NUM_THREADS]; | 24 | static pthread_t threads[NUM_THREADS]; |
26 | static unsigned int seeds[3]; | 25 | static unsigned int seeds[3]; |
27 | static RADIX_TREE(tree, GFP_KERNEL); | 26 | static 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; |