From: "Liam R. Howlett" <Liam.Howlett@oracle.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: maple-tree@lists.infradead.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org,
"Liam R. Howlett" <Liam.Howlett@oracle.com>
Subject: [PATCH v2 10/36] maple_tree: Use MAS_BUG_ON() when setting a leaf node as a parent
Date: Fri, 5 May 2023 13:41:38 -0400 [thread overview]
Message-ID: <20230505174204.2665599-11-Liam.Howlett@oracle.com> (raw)
In-Reply-To: <20230505174204.2665599-1-Liam.Howlett@oracle.com>
Use MAS_BUG_ON() to dump the maple state and tree in the unlikely event
of an issue.
Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
---
lib/maple_tree.c | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/lib/maple_tree.c b/lib/maple_tree.c
index 8fd83f21caf00..a594f1d88d062 100644
--- a/lib/maple_tree.c
+++ b/lib/maple_tree.c
@@ -453,7 +453,7 @@ enum maple_type mas_parent_type(struct ma_state *mas, struct maple_enode *enode)
}
/*
- * mte_set_parent() - Set the parent node and encode the slot
+ * mas_set_parent() - Set the parent node and encode the slot
* @enode: The encoded maple node.
* @parent: The encoded maple node that is the parent of @enode.
* @slot: The slot that @enode resides in @parent.
@@ -462,16 +462,16 @@ enum maple_type mas_parent_type(struct ma_state *mas, struct maple_enode *enode)
* parent type.
*/
static inline
-void mte_set_parent(struct maple_enode *enode, const struct maple_enode *parent,
- unsigned char slot)
+void mas_set_parent(struct ma_state *mas, struct maple_enode *enode,
+ const struct maple_enode *parent, unsigned char slot)
{
unsigned long val = (unsigned long)parent;
unsigned long shift;
unsigned long type;
enum maple_type p_type = mte_node_type(parent);
- BUG_ON(p_type == maple_dense);
- BUG_ON(p_type == maple_leaf_64);
+ MAS_BUG_ON(mas, p_type == maple_dense);
+ MAS_BUG_ON(mas, p_type == maple_leaf_64);
switch (p_type) {
case maple_range_64:
@@ -1740,7 +1740,7 @@ static inline void mas_adopt_children(struct ma_state *mas,
offset = ma_data_end(node, type, pivots, mas->max);
do {
child = mas_slot_locked(mas, slots, offset);
- mte_set_parent(child, parent, offset);
+ mas_set_parent(mas, child, parent, offset);
} while (offset--);
}
@@ -2705,9 +2705,9 @@ static inline void mas_set_split_parent(struct ma_state *mas,
return;
if ((*slot) <= split)
- mte_set_parent(mas->node, left, *slot);
+ mas_set_parent(mas, mas->node, left, *slot);
else if (right)
- mte_set_parent(mas->node, right, (*slot) - split - 1);
+ mas_set_parent(mas, mas->node, right, (*slot) - split - 1);
(*slot)++;
}
@@ -3104,12 +3104,12 @@ static int mas_spanning_rebalance(struct ma_state *mas,
mte_node_type(mast->orig_l->node));
mast->orig_l->depth++;
mab_mas_cp(mast->bn, 0, mt_slots[mast->bn->type] - 1, &l_mas, true);
- mte_set_parent(left, l_mas.node, slot);
+ mas_set_parent(mas, left, l_mas.node, slot);
if (middle)
- mte_set_parent(middle, l_mas.node, ++slot);
+ mas_set_parent(mas, middle, l_mas.node, ++slot);
if (right)
- mte_set_parent(right, l_mas.node, ++slot);
+ mas_set_parent(mas, right, l_mas.node, ++slot);
if (mas_is_root_limits(mast->l)) {
new_root:
@@ -3336,8 +3336,8 @@ static inline bool mas_split_final_node(struct maple_subtree_state *mast,
* The Big_node data should just fit in a single node.
*/
ancestor = mas_new_ma_node(mas, mast->bn);
- mte_set_parent(mast->l->node, ancestor, mast->l->offset);
- mte_set_parent(mast->r->node, ancestor, mast->r->offset);
+ mas_set_parent(mas, mast->l->node, ancestor, mast->l->offset);
+ mas_set_parent(mas, mast->r->node, ancestor, mast->r->offset);
mte_to_node(ancestor)->parent = mas_mn(mas)->parent;
mast->l->node = ancestor;
--
2.39.2
next prev parent reply other threads:[~2023-05-05 17:44 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-05 17:41 [PATCH v2 00/36] Maple tree mas_{next,prev}_range() and cleanup Liam R. Howlett
2023-05-05 17:41 ` [PATCH v2 01/36] maple_tree: Fix static analyser cppcheck issue Liam R. Howlett
2023-05-05 17:41 ` [PATCH v2 02/36] maple_tree: Clean up mas_parent_enum() and rename to mas_parent_type() Liam R. Howlett
2023-05-05 17:41 ` [PATCH v2 03/36] maple_tree: Avoid unnecessary ascending Liam R. Howlett
2023-05-05 17:41 ` [PATCH v2 04/36] maple_tree: Clean up mas_dfs_postorder() Liam R. Howlett
2023-05-05 17:41 ` [PATCH v2 05/36] maple_tree: Add format option to mt_dump() Liam R. Howlett
2023-05-05 17:41 ` [PATCH v2 06/36] maple_tree: Add debug BUG_ON and WARN_ON variants Liam R. Howlett
2023-05-05 17:41 ` [PATCH v2 07/36] maple_tree: Convert BUG_ON() to MT_BUG_ON() Liam R. Howlett
2023-05-05 17:41 ` [PATCH v2 08/36] maple_tree: Change RCU checks to WARN_ON() instead of BUG_ON() Liam R. Howlett
2023-05-05 17:41 ` [PATCH v2 09/36] maple_tree: Convert debug code to use MT_WARN_ON() and MAS_WARN_ON() Liam R. Howlett
2023-05-05 17:41 ` Liam R. Howlett [this message]
2023-05-05 17:41 ` [PATCH v2 11/36] maple_tree: Use MAS_BUG_ON() in mas_set_height() Liam R. Howlett
2023-05-05 17:41 ` [PATCH v2 12/36] maple_tree: Use MAS_BUG_ON() from mas_topiary_range() Liam R. Howlett
2023-05-05 17:41 ` [PATCH v2 13/36] maple_tree: Use MAS_WR_BUG_ON() in mas_store_prealloc() Liam R. Howlett
2023-05-05 17:41 ` [PATCH v2 14/36] maple_tree: Use MAS_BUG_ON() prior to calling mas_meta_gap() Liam R. Howlett
2023-05-05 17:41 ` [PATCH v2 15/36] maple_tree: Return error on mte_pivots() out of range Liam R. Howlett
2023-05-05 17:41 ` [PATCH v2 16/36] maple_tree: Make test code work without debug enabled Liam R. Howlett
2023-05-05 17:41 ` [PATCH v2 17/36] mm: Update validate_mm() to use vma iterator Liam R. Howlett
2023-05-05 17:41 ` [PATCH v2 18/36] mm: Update vma_iter_store() to use MAS_WARN_ON() Liam R. Howlett
2023-05-06 2:42 ` Sergey Senozhatsky
2023-05-06 2:47 ` Sergey Senozhatsky
2023-05-05 17:41 ` [PATCH v2 19/36] maple_tree: Add __init and __exit to test module Liam R. Howlett
2023-05-05 17:41 ` [PATCH v2 20/36] maple_tree: Remove unnecessary check from mas_destroy() Liam R. Howlett
2023-05-05 17:41 ` [PATCH v2 21/36] maple_tree: mas_start() reset depth on dead node Liam R. Howlett
2023-05-05 17:41 ` [PATCH v2 22/36] mm/mmap: Change do_vmi_align_munmap() for maple tree iterator changes Liam R. Howlett
2023-05-05 17:41 ` [PATCH v2 23/36] maple_tree: Try harder to keep active node after mas_next() Liam R. Howlett
2023-05-05 17:41 ` [PATCH v2 24/36] maple_tree: Try harder to keep active node with mas_prev() Liam R. Howlett
2023-05-05 17:41 ` [PATCH v2 25/36] maple_tree: Revise limit checks in mas_empty_area{_rev}() Liam R. Howlett
2023-05-05 17:41 ` [PATCH v2 26/36] maple_tree: Fix testing mas_empty_area() Liam R. Howlett
2023-05-05 17:41 ` [PATCH v2 27/36] maple_tree: Introduce mas_next_slot() interface Liam R. Howlett
2023-05-05 17:41 ` [PATCH v2 28/36] maple_tree: Add mas_next_range() and mas_find_range() interfaces Liam R. Howlett
2023-05-05 17:41 ` [PATCH v2 29/36] maple_tree: Relocate mas_rewalk() and mas_rewalk_if_dead() Liam R. Howlett
2023-05-05 17:41 ` [PATCH v2 30/36] maple_tree: Introduce mas_prev_slot() interface Liam R. Howlett
2023-05-05 17:41 ` [PATCH v2 31/36] maple_tree: Add mas_prev_range() and mas_find_range_rev interface Liam R. Howlett
2023-05-08 13:26 ` Vernon Yang
2023-05-08 16:11 ` Liam R. Howlett
2023-05-05 17:42 ` [PATCH v2 32/36] maple_tree: Clear up index and last setting in single entry tree Liam R. Howlett
2023-05-09 12:39 ` Peng Zhang
2023-05-12 15:54 ` Liam R. Howlett
2023-05-12 17:29 ` Liam R. Howlett
2023-05-05 17:42 ` [PATCH v2 33/36] maple_tree: Update testing code for mas_{next,prev,walk} Liam R. Howlett
2023-05-05 17:42 ` [PATCH v2 34/36] mm: Add vma_iter_{next,prev}_range() to vma iterator Liam R. Howlett
2023-05-05 17:42 ` [PATCH v2 35/36] mm: Avoid rewalk in mmap_region Liam R. Howlett
2023-05-05 17:42 ` [PATCH v2 36/36] maple_tree: Add gap to check_alloc_rev_range() testcase Liam R. Howlett
2023-05-05 19:29 ` Liam R. Howlett
2023-05-05 19:57 ` Andrew Morton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230505174204.2665599-11-Liam.Howlett@oracle.com \
--to=liam.howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=maple-tree@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox