summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wilcox <willy@linux.intel.com>2016-12-15 00:09:22 +0100
committerLinus Torvalds <torvalds@linux-foundation.org>2016-12-15 01:04:10 +0100
commit424251a4a929a1b6dff2056d49135e3805132e32 (patch)
tree191e913288fe1c45d64e93e5715e00fd47221457
parentrxrpc: abstract away knowledge of IDR internals (diff)
downloadlinux-424251a4a929a1b6dff2056d49135e3805132e32.tar.xz
linux-424251a4a929a1b6dff2056d49135e3805132e32.zip
idr: reduce the number of bits per level from 8 to 6
In preparation for merging the IDR and radix tree, reduce the fanout at each level from 256 to 64. If this causes a performance problem then a bisect will point to this commit, and we'll have a better idea about what we might do to fix it. Link: http://lkml.kernel.org/r/1480369871-5271-66-git-send-email-mawilcox@linuxonhyperv.com Signed-off-by: Matthew Wilcox <willy@linux.intel.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: Matthew Wilcox <mawilcox@microsoft.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--include/linux/idr.h9
1 files changed, 4 insertions, 5 deletions
diff --git a/include/linux/idr.h b/include/linux/idr.h
index 1eb755f77f2f..3c01b89aed67 100644
--- a/include/linux/idr.h
+++ b/include/linux/idr.h
@@ -18,12 +18,11 @@
#include <linux/rcupdate.h>
/*
- * We want shallower trees and thus more bits covered at each layer. 8
- * bits gives us large enough first layer for most use cases and maximum
- * tree depth of 4. Each idr_layer is slightly larger than 2k on 64bit and
- * 1k on 32bit.
+ * Using 6 bits at each layer allows us to allocate 7 layers out of each page.
+ * 8 bits only gave us 3 layers out of every pair of pages, which is less
+ * efficient except for trees with a largest element between 192-255 inclusive.
*/
-#define IDR_BITS 8
+#define IDR_BITS 6
#define IDR_SIZE (1 << IDR_BITS)
#define IDR_MASK ((1 << IDR_BITS)-1)