summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMatthew Wilcox <mawilcox@microsoft.com>2017-01-17 00:41:29 +0300
committerMatthew Wilcox <mawilcox@microsoft.com>2017-02-14 05:44:04 +0300
commit1293d5c5f54d5118fbb34fc94e01ba02fcd25fc1 (patch)
treed2ff3550817eb4110766b56e4a2032e8502a0b33 /lib
parent73bc029b76482260a144219786d19951f561716e (diff)
downloadlinux-1293d5c5f54d5118fbb34fc94e01ba02fcd25fc1.tar.xz
radix-tree: Chain preallocated nodes through ->parent
Chaining through the ->private_data member means we have to zero ->private_data after removing preallocated nodes from the list. We're about to initialise ->parent anyway, so we can avoid zeroing it. Signed-off-by: Matthew Wilcox <mawilcox@microsoft.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/radix-tree.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/radix-tree.c b/lib/radix-tree.c
index 14130ab197c0..66c71312c381 100644
--- a/lib/radix-tree.c
+++ b/lib/radix-tree.c
@@ -82,7 +82,7 @@ static struct kmem_cache *radix_tree_node_cachep;
*/
struct radix_tree_preload {
unsigned nr;
- /* nodes->private_data points to next preallocated node */
+ /* nodes->parent points to next preallocated node */
struct radix_tree_node *nodes;
};
static DEFINE_PER_CPU(struct radix_tree_preload, radix_tree_preloads) = { 0, };
@@ -405,8 +405,7 @@ radix_tree_node_alloc(gfp_t gfp_mask, struct radix_tree_node *parent,
rtp = this_cpu_ptr(&radix_tree_preloads);
if (rtp->nr) {
ret = rtp->nodes;
- rtp->nodes = ret->private_data;
- ret->private_data = NULL;
+ rtp->nodes = ret->parent;
rtp->nr--;
}
/*
@@ -483,7 +482,7 @@ static int __radix_tree_preload(gfp_t gfp_mask, unsigned nr)
preempt_disable();
rtp = this_cpu_ptr(&radix_tree_preloads);
if (rtp->nr < nr) {
- node->private_data = rtp->nodes;
+ node->parent = rtp->nodes;
rtp->nodes = node;
rtp->nr++;
} else {
@@ -2260,7 +2259,7 @@ static int radix_tree_cpu_dead(unsigned int cpu)
rtp = &per_cpu(radix_tree_preloads, cpu);
while (rtp->nr) {
node = rtp->nodes;
- rtp->nodes = node->private_data;
+ rtp->nodes = node->parent;
kmem_cache_free(radix_tree_node_cachep, node);
rtp->nr--;
}