diff options
Diffstat (limited to 'tools/testing/radix-tree/regression1.c')
-rw-r--r-- | tools/testing/radix-tree/regression1.c | 17 |
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 | ||
46 | static RADIX_TREE(mt_tree, GFP_KERNEL); | 46 | static RADIX_TREE(mt_tree, GFP_KERNEL); |
47 | static pthread_mutex_t mt_lock = PTHREAD_MUTEX_INITIALIZER; | ||
48 | 47 | ||
49 | struct page { | 48 | struct 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 { |