aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/idr.h
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2013-02-27 20:05:06 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2013-02-27 22:10:20 -0500
commit050a6b47d98e2bcea909c1129111e721668aaa2c (patch)
tree129480e1dd2b1e8d4129239ec508f7927f4d4b5a /include/linux/idr.h
parent1d9b2e1e663719d406e3a770979a19ba4233bba0 (diff)
idr: make idr_layer larger
With recent preloading changes, idr no longer keeps full layer cache per each idr instance (used to be ~6.5k per idr on 64bit) and the previous patch removed restriction on the bitmap size. Both now allow us to have larger layers. Increase IDR_BITS to 8 regardless of BITS_PER_LONG. Each layer is slightly larger than 2k on 64bit and 1k on 32bit and carries 256 entries. The size isn't too large, especially compared to what we used to waste on per-idr caches, and 256 entries should be able to serve most use cases with single layer. The max tree depth is 4 which is much better than the previous 6 on 64bit and 7 on 32bit. Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/idr.h')
-rw-r--r--include/linux/idr.h15
1 files changed, 7 insertions, 8 deletions
diff --git a/include/linux/idr.h b/include/linux/idr.h
index 63aa542da49b..43b87b1c77a3 100644
--- a/include/linux/idr.h
+++ b/include/linux/idr.h
@@ -17,14 +17,13 @@
17#include <linux/init.h> 17#include <linux/init.h>
18#include <linux/rcupdate.h> 18#include <linux/rcupdate.h>
19 19
20#if BITS_PER_LONG == 32 20/*
21# define IDR_BITS 5 21 * We want shallower trees and thus more bits covered at each layer. 8
22#elif BITS_PER_LONG == 64 22 * bits gives us large enough first layer for most use cases and maximum
23# define IDR_BITS 6 23 * tree depth of 4. Each idr_layer is slightly larger than 2k on 64bit and
24#else 24 * 1k on 32bit.
25# error "BITS_PER_LONG is not 32 or 64" 25 */
26#endif 26#define IDR_BITS 8
27
28#define IDR_SIZE (1 << IDR_BITS) 27#define IDR_SIZE (1 << IDR_BITS)
29#define IDR_MASK ((1 << IDR_BITS)-1) 28#define IDR_MASK ((1 << IDR_BITS)-1)
30 29