Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 050a6b47 authored by Tejun Heo's avatar Tejun Heo Committed by Linus Torvalds
Browse files

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: default avatarTejun Heo <tj@kernel.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 1d9b2e1e
Loading
Loading
Loading
Loading
+7 −8
Original line number Original line Diff line number Diff line
@@ -17,14 +17,13 @@
#include <linux/init.h>
#include <linux/init.h>
#include <linux/rcupdate.h>
#include <linux/rcupdate.h>


#if BITS_PER_LONG == 32
/*
# define IDR_BITS 5
 * We want shallower trees and thus more bits covered at each layer.  8
#elif BITS_PER_LONG == 64
 * bits gives us large enough first layer for most use cases and maximum
# define IDR_BITS 6
 * tree depth of 4.  Each idr_layer is slightly larger than 2k on 64bit and
#else
 * 1k on 32bit.
# error "BITS_PER_LONG is not 32 or 64"
 */
#endif
#define IDR_BITS 8

#define IDR_SIZE (1 << IDR_BITS)
#define IDR_SIZE (1 << IDR_BITS)
#define IDR_MASK ((1 << IDR_BITS)-1)
#define IDR_MASK ((1 << IDR_BITS)-1)