Skip to contentSkip to conversation

maple_tree: Fix handle of invalidated state in mas_wr_store_setup()

PATCH In review Liam Howlett 3 participants 7 messages Jan 9, 2023 – Jan 11, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 maple_tree: Fix handle of invalidated state in mas_wr_store_setup()

If an invalidated maple state is encountered during write, reset the maple state to MAS_START. This will result in a re-walk of the tree to the correct location for the write.

---
 lib/maple_tree.c | 3 +++
 1 file changed, 3 insertions(+)
lib/maple_tree.c +3 -0
index 14cff87cf058..59c4879ac714 100644
@@ -5620,6 +5620,9 @@ static inline void mte_destroy_walk(struct maple_enode *enode,
 
 static void mas_wr_store_setup(struct ma_wr_state *wr_mas)
 {
+	if (unlikely(mas_is_paused(wr_mas->mas)))
+		mas_reset(wr_mas->mas);
+
 	if (!mas_is_start(wr_mas->mas)) {
 		if (mas_is_none(wr_mas->mas)) {
 			mas_reset(wr_mas->mas);
Signature · 1 line
2.35.1
Tested-by on v1 1/1
#1 lore raw
Quoted 7 lines · On Mon, 9 Jan 2023 16:55:42 +0000 Liam Howlett <[email protected]> wrote:

If an invalidated maple state is encountered during write, reset the maple state to MAS_START. This will result in a re-walk of the tree to the correct location for the write.

I confirmed this patch fixes the boot failure issue. Nevertheless, the 'make install' issue on my system is still not fixed.

Thanks,
SJ

Quoted 21 lines
---
 lib/maple_tree.c | 3 +++
 1 file changed, 3 insertions(+)
lib/maple_tree.c +3 -0
index 14cff87cf058..59c4879ac714 100644
@@ -5620,6 +5620,9 @@ static inline void mte_destroy_walk(struct maple_enode *enode,
 
 static void mas_wr_store_setup(struct ma_wr_state *wr_mas)
 {
+	if (unlikely(mas_is_paused(wr_mas->mas)))
+		mas_reset(wr_mas->mas);
+
 	if (!mas_is_start(wr_mas->mas)) {
 		if (mas_is_none(wr_mas->mas)) {
 			mas_reset(wr_mas->mas);
Signature · 1 line
2.35.1
maintainer
#2 lore raw
Quoted 5 lines · On Mon, 9 Jan 2023 19:22:48 +0000 SeongJae Park <[email protected]> wrote:
Quoted 3 lines · On Mon, 9 Jan 2023 16:55:42 +0000 Liam Howlett <[email protected]> wrote:

If an invalidated maple state is encountered during write, reset the maple state to MAS_START. This will result in a re-walk of the tree to the correct location for the write.

Can we think of a Fixes: for this?

Quoted 8 lines
Quoted 3 lines

I confirmed this patch fixes the boot failure issue. Nevertheless, the 'make install' issue on my system is still not fixed.

Is this a mainline issue or an mm-unstable issue?

#3 lore raw

Hi Andrew,

Quoted 14 lines · On Mon, 9 Jan 2023 15:40:12 -0800 Andrew Morton <[email protected]>…
Quoted 5 lines · On Mon, 9 Jan 2023 19:22:48 +0000 SeongJae Park <[email protected]> wrote:
Quoted 3 lines · On Mon, 9 Jan 2023 16:55:42 +0000 Liam Howlett <[email protected]> wrote:

If an invalidated maple state is encountered during write, reset the maple state to MAS_START. This will result in a re-walk of the tree to the correct location for the write.

Can we think of a Fixes: for this?

Quoted 4 lines
Quoted 3 lines
Quoted 6 lines
Quoted 4 lines

I confirmed this patch fixes the boot failure issue. Nevertheless, the 'make install' issue on my system is still not fixed.

Is this a mainline issue or an mm-unstable issue?

It's mm-unstable issue:
https://lore.kernel.org/linux-mm/[email protected]/

Thanks,
SJ

#4 lore raw
Quoted 13 lines · SeongJae Park

Hi Andrew,

Quoted 9 lines · On Mon, 9 Jan 2023 15:40:12 -0800 Andrew Morton <[email protected]>…
Quoted 5 lines · On Mon, 9 Jan 2023 19:22:48 +0000 SeongJae Park <[email protected]> wrote:
Quoted 3 lines · On Mon, 9 Jan 2023 16:55:42 +0000 Liam Howlett <[email protected]> wrote:

If an invalidated maple state is encountered during write, reset the maple state to MAS_START. This will result in a re-walk of the tree to the correct location for the write.

Can we think of a Fixes: for this?

It wasn't really an issue until I wrote the vma iterator store function.

You can put this before (mm-unstable git id..) 9df3d25a97ec ("mm: expand vma iterator interface")

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 4 lines
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

I confirmed this patch fixes the boot failure issue. Nevertheless, the 'make install' issue on my system is still not fixed.

Is this a mainline issue or an mm-unstable issue?

It's mm-unstable issue:
https://lore.kernel.org/linux-mm/[email protected]/

Yes, just mm-unstable.

maintainer
#5 lore raw
Quoted 13 lines · On Tue, 10 Jan 2023 14:21:15 +0000 Liam Howlett <[email protected]> wrote:
Quoted 12 lines · SeongJae Park

Hi Andrew,

Quoted 8 lines · On Mon, 9 Jan 2023 15:40:12 -0800 Andrew Morton <[email protected]>…
Quoted 5 lines · On Mon, 9 Jan 2023 19:22:48 +0000 SeongJae Park <[email protected]> wrote:
Quoted 3 lines · On Mon, 9 Jan 2023 16:55:42 +0000 Liam Howlett <[email protected]> wrote:

If an invalidated maple state is encountered during write, reset the maple state to MAS_START. This will result in a re-walk of the tree to the correct location for the write.

Quoted 7 lines
Quoted 1 line
Quoted 1 line

Can we think of a Fixes: for this?

It wasn't really an issue until I wrote the vma iterator store function.

You can put this before (mm-unstable git id..) 9df3d25a97ec ("mm: expand vma iterator interface")

I have dropped "mm: expand vma iterator interface"'s series. Should we retain this patch as a standalone thing and is the changelog still appropriate?

#6 lore raw
Quoted 20 lines · Andrew Morton
Quoted 18 lines · On Tue, 10 Jan 2023 14:21:15 +0000 Liam Howlett <[email protected]> wrote:
Quoted 13 lines · SeongJae Park

Hi Andrew,

Quoted 9 lines · On Mon, 9 Jan 2023 15:40:12 -0800 Andrew Morton <[email protected]>…
Quoted 5 lines · On Mon, 9 Jan 2023 19:22:48 +0000 SeongJae Park <[email protected]> wrote:
Quoted 3 lines · On Mon, 9 Jan 2023 16:55:42 +0000 Liam Howlett <[email protected]> wrote:

If an invalidated maple state is encountered during write, reset the maple state to MAS_START. This will result in a re-walk of the tree to the correct location for the write.

Can we think of a Fixes: for this?

It wasn't really an issue until I wrote the vma iterator store function.

Quoted 6 lines
Quoted 2 lines

You can put this before (mm-unstable git id..) 9df3d25a97ec ("mm: expand vma iterator interface")

I have dropped "mm: expand vma iterator interface"'s series. Should we retain this patch as a standalone thing and is the changelog still appropriate?

No, just drop it and I'll re-spin v3 to include maple tree fixes on the top.