aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing
diff options
context:
space:
mode:
authorMatthew Wilcox <willy@infradead.org>2018-07-04 15:42:46 -0400
committerMatthew Wilcox <willy@infradead.org>2018-10-21 10:46:33 -0400
commitf32f004cddf86d63a9c42994bbce9f4e2f07c9fa (patch)
treeecd72e417a02e78fc70622c9eb1a889044138e10 /tools/testing
parent371c752dc66948714ee3b66c3306f3ff1ff71d2e (diff)
ida: Convert to XArray
Use the XA_TRACK_FREE ability to track which entries have a free bit, similarly to how it uses the radix tree's IDR_FREE tag. This eliminates the per-cpu ida_bitmap preload, and fixes the memory consumption regression I introduced when making the IDR able to store any pointer. Signed-off-by: Matthew Wilcox <willy@infradead.org>
Diffstat (limited to 'tools/testing')
-rw-r--r--tools/testing/radix-tree/idr-test.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/tools/testing/radix-tree/idr-test.c b/tools/testing/radix-tree/idr-test.c
index a5a4494922a6..1b63bdb7688f 100644
--- a/tools/testing/radix-tree/idr-test.c
+++ b/tools/testing/radix-tree/idr-test.c
@@ -402,16 +402,15 @@ void ida_check_nomem(void)
402 */ 402 */
403void ida_check_conv_user(void) 403void ida_check_conv_user(void)
404{ 404{
405#if 0
406 DEFINE_IDA(ida); 405 DEFINE_IDA(ida);
407 unsigned long i; 406 unsigned long i;
408 407
409 radix_tree_cpu_dead(1);
410 for (i = 0; i < 1000000; i++) { 408 for (i = 0; i < 1000000; i++) {
411 int id = ida_alloc(&ida, GFP_NOWAIT); 409 int id = ida_alloc(&ida, GFP_NOWAIT);
412 if (id == -ENOMEM) { 410 if (id == -ENOMEM) {
413 IDA_BUG_ON(&ida, (i % IDA_BITMAP_BITS) != 411 IDA_BUG_ON(&ida, ((i % IDA_BITMAP_BITS) !=
414 BITS_PER_XA_VALUE); 412 BITS_PER_XA_VALUE) &&
413 ((i % IDA_BITMAP_BITS) != 0));
415 id = ida_alloc(&ida, GFP_KERNEL); 414 id = ida_alloc(&ida, GFP_KERNEL);
416 } else { 415 } else {
417 IDA_BUG_ON(&ida, (i % IDA_BITMAP_BITS) == 416 IDA_BUG_ON(&ida, (i % IDA_BITMAP_BITS) ==
@@ -420,7 +419,6 @@ void ida_check_conv_user(void)
420 IDA_BUG_ON(&ida, id != i); 419 IDA_BUG_ON(&ida, id != i);
421 } 420 }
422 ida_destroy(&ida); 421 ida_destroy(&ida);
423#endif
424} 422}
425 423
426void ida_check_random(void) 424void ida_check_random(void)