Reimplement IDR and IDA using the radix tree
authorMatthew Wilcox <mawilcox@microsoft.com>
Tue, 20 Dec 2016 15:27:56 +0000 (10:27 -0500)
committerMatthew Wilcox <mawilcox@microsoft.com>
Tue, 14 Feb 2017 02:44:01 +0000 (21:44 -0500)
commit0a835c4f090af2c76fc2932c539c3b32fd21fbbb
tree729c24514309afc323ee08e6d8336eb1e558406e
parent0ac398ef391b53122976325ab6953456ce8e8310
Reimplement IDR and IDA using the radix tree

The IDR is very similar to the radix tree.  It has some functionality that
the radix tree did not have (alloc next free, cyclic allocation, a
callback-based for_each, destroy tree), which is readily implementable on
top of the radix tree.  A few small changes were needed in order to use a
tag to represent nodes with free space below them.  More extensive
changes were needed to support storing NULL as a valid entry in an IDR.
Plain radix trees still interpret NULL as a not-present entry.

The IDA is reimplemented as a client of the newly enhanced radix tree.  As
in the current implementation, it uses a bitmap at the last level of the
tree.

Signed-off-by: Matthew Wilcox <willy@infradead.org>
Signed-off-by: Matthew Wilcox <mawilcox@microsoft.com>
Tested-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Konstantin Khlebnikov <koct9i@gmail.com>
Cc: Ross Zwisler <ross.zwisler@linux.intel.com>
Cc: Tejun Heo <tj@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
13 files changed:
include/linux/idr.h
include/linux/radix-tree.h
init/main.c
lib/idr.c
lib/radix-tree.c
tools/testing/radix-tree/.gitignore
tools/testing/radix-tree/Makefile
tools/testing/radix-tree/idr-test.c [new file with mode: 0644]
tools/testing/radix-tree/linux/gfp.h
tools/testing/radix-tree/linux/idr.h [new file with mode: 0644]
tools/testing/radix-tree/linux/kernel.h
tools/testing/radix-tree/main.c
tools/testing/radix-tree/test.h