From 7b04f144dc72a04cfe1d07a72016923bb1ffb45a Mon Sep 17 00:00:00 2001 From: "Liam R. Howlett" Date: Tue, 6 Oct 2020 15:21:06 -0400 Subject: [PATCH] maple_tree: Drop span_enode to get ma_state to one cacheline Signed-off-by: Liam R. Howlett --- include/linux/maple_tree.h | 1 - lib/maple_tree.c | 19 ++++++------------- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/include/linux/maple_tree.h b/include/linux/maple_tree.h index ca6678621971..0810c7427cb4 100644 --- a/include/linux/maple_tree.h +++ b/include/linux/maple_tree.h @@ -194,7 +194,6 @@ struct ma_state { unsigned long min; /* The minimum index of this node - implied pivot min */ unsigned long max; /* The maximum index of this node - implied pivot max */ struct maple_node *alloc; /* Allocated nodes for this operation */ - struct maple_enode *span_enode; /* Pointer to maple parent/slot that set the max */ unsigned char depth; /* depth of tree descent during write */ }; diff --git a/lib/maple_tree.c b/lib/maple_tree.c index f8953d3cb1ca..e3d2a10e330e 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -2764,7 +2764,7 @@ exists: /* * - * mas_is_span_() - Set span_enode if there is no value already and the + * mas_is_span_() - Check if the write spans the node. * entry being written spans this nodes slot or touches the end of this slot and * is NULL. * @piv - the pivot of the slot in this node @@ -2794,7 +2794,6 @@ bool mas_is_span_wr(struct ma_state *mas, unsigned long piv, } trace_mas_is_span_wr(mas, piv, entry); - mas->span_enode = mas->node; return true; } @@ -2854,19 +2853,16 @@ bool mas_wr_walk(struct ma_state *mas, unsigned long *range_min, { enum maple_type type; - mas->span_enode = NULL; while (true) { type = mte_node_type(mas->node); mas->depth++; - if (unlikely(!mas_node_walk(mas, type, range_min, range_max))) - return false; - + mas_node_walk(mas, type, range_min, range_max); if (mas_is_span_wr(mas, *range_max, type, entry)) - return ma_is_leaf(type); + return false; if (ma_is_leaf(type)) - return true; + break; // Traverse. mas->max = *range_max; @@ -2874,7 +2870,7 @@ bool mas_wr_walk(struct ma_state *mas, unsigned long *range_min, mas->node = mas_get_slot(mas, mas_offset(mas)); mas_set_offset(mas, 0); } - return false; + return true; } static inline void mas_extend_null(struct ma_state *l_mas, struct ma_state *r_mas) @@ -3108,10 +3104,7 @@ static inline void *_mas_store(struct ma_state *mas, void *entry, bool overwrite goto complete_at_root; } - if (!mas_wr_walk(mas, &r_min, &r_max, entry) && !mas->span_enode) - return NULL; - - if (mas->span_enode) { + if (!mas_wr_walk(mas, &r_min, &r_max, entry)) { if (!overwrite) { mas_set_err(mas, -EEXIST); return NULL; // spanning writes always overwrite something. -- 2.50.1