idr: reduce the number of bits per level from 8 to 6
PATCH 109/114 idr: reduce the number of bits per level from 8 to 6
From: Matthew Wilcox <[email protected]>
Subject: 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.
Signed-off-by Matthew Wilcox <[email protected]>
Tested-by Kirill A. Shutemov <[email protected]>
Cc Konstantin Khlebnikov <[email protected]>
Cc Ross Zwisler <[email protected]>
Cc Matthew Wilcox <[email protected]>
Signed-off-by Andrew Morton <[email protected]>
---
include/linux/idr.h | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
include/linux/idr.h renamed from include/linux/idr.h~idr-reduce-the-number-of-bits-per-level-from-8-to-6 +4 -5
@@ -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)
_