Skip to contentSkip to conversation

FAILED: patch "[PATCH] mm/mempolicy: fix set_mempolicy_home_node() previous VMA" failed to apply to 6.1-stable tree

PATCH New [email protected] 3 participants 6 messages Oct 27, 2023 – Nov 1, 2023

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

The patch below does not apply to the 6.1-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

To reproduce the conflict and resubmit, you may use the following commands:

git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.1.y
git checkout FETCH_HEAD
git cherry-pick -x 51f625377561e5b167da2db5aafb7ee268f691c5
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2023102704-surrogate-dole-2888@gregkh' --subject-prefix 'PATCH 6.1.y' HEAD^..

Possible dependencies:

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From 51f625377561e5b167da2db5aafb7ee268f691c5 Mon Sep 17 00:00:00 2001
From: "Liam R. Howlett" <[email protected]>
Date: Thu, 28 Sep 2023 13:24:32 -0400
Subject: [PATCH] mm/mempolicy: fix set_mempolicy_home_node() previous VMA
pointer

The two users of mbind_range() are expecting that mbind_range() will update the pointer to the previous VMA, or return an error. However, set_mempolicy_home_node() does not call mbind_range() if there is no VMA policy. The fix is to update the pointer to the previous VMA prior to continuing iterating the VMAs when there is no policy.

Users may experience a WARN_ON() during VMA policy updates when updating a range of VMAs on the home node.

mm/mempolicy.c +3 -1
index f1b00d6ac7ee..29ebf1e7898c 100644
@@ -1543,8 +1543,10 @@ SYSCALL_DEFINE4(set_mempolicy_home_node, unsigned long, start, unsigned long, le
 		 * the home node for vmas we already updated before.
 		 */
 		old = vma_policy(vma);
-		if (!old)
+		if (!old) {
+			prev = vma;
 			continue;
+		}
 		if (old->mode != MPOL_BIND && old->mode != MPOL_PREFERRED_MANY) {
 			err = -EOPNOTSUPP;
 			break;
#1 lore raw

Added Michal to the Cc as I'm referencing his patch below.

Quoted 8 lines · * [email protected] <[email protected]> [231027 08:14]:

The patch below does not apply to the 6.1-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

To reproduce the conflict and resubmit, you may use the following commands:

Quoted 8 lines

git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.1.y
git checkout FETCH_HEAD
git cherry-pick -x 51f625377561e5b167da2db5aafb7ee268f691c5
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2023102704-surrogate-dole-2888@gregkh' --subject-prefix 'PATCH 6.1.y' HEAD^..

Possible dependencies:

Can we add this patch to the dependency list? It will allow my patch to be applied cleanly, and looks like it is close to a valid backport itself.

e976936cfc66 ("mm/mempolicy: do not duplicate policy if it is not applicable for set_mempolicy_home_node")

If you don't agree, I can rework my patch to work without it.

Thanks,
Liam

...

Quoted 44 lines

------------------ original commit in Linus's tree ------------------

From 51f625377561e5b167da2db5aafb7ee268f691c5 Mon Sep 17 00:00:00 2001
From: "Liam R. Howlett" <[email protected]>
Date: Thu, 28 Sep 2023 13:24:32 -0400
Subject: [PATCH] mm/mempolicy: fix set_mempolicy_home_node() previous VMA
pointer

The two users of mbind_range() are expecting that mbind_range() will update the pointer to the previous VMA, or return an error. However, set_mempolicy_home_node() does not call mbind_range() if there is no VMA policy. The fix is to update the pointer to the previous VMA prior to continuing iterating the VMAs when there is no policy.

Users may experience a WARN_ON() during VMA policy updates when updating a range of VMAs on the home node.

mm/mempolicy.c +3 -1
index f1b00d6ac7ee..29ebf1e7898c 100644
@@ -1543,8 +1543,10 @@ SYSCALL_DEFINE4(set_mempolicy_home_node, unsigned long, start, unsigned long, le
 		 * the home node for vmas we already updated before.
 		 */
 		old = vma_policy(vma);
-		if (!old)
+		if (!old) {
+			prev = vma;
 			continue;
+		}
 		if (old->mode != MPOL_BIND && old->mode != MPOL_PREFERRED_MANY) {
 			err = -EOPNOTSUPP;
 			break;
author maintainer
#2 lore raw
Quoted 19 lines · Liam R. Howlett

Added Michal to the Cc as I'm referencing his patch below.

Quoted 15 lines · * [email protected] <[email protected]> [231027 08:14]:

The patch below does not apply to the 6.1-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

To reproduce the conflict and resubmit, you may use the following commands:

git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.1.y
git checkout FETCH_HEAD
git cherry-pick -x 51f625377561e5b167da2db5aafb7ee268f691c5
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2023102704-surrogate-dole-2888@gregkh' --subject-prefix 'PATCH 6.1.y' HEAD^..

Quoted 8 lines
Quoted 1 line

Possible dependencies:

Can we add this patch to the dependency list? It will allow my patch to be applied cleanly, and looks like it is close to a valid backport itself.

e976936cfc66 ("mm/mempolicy: do not duplicate policy if it is not applicable for set_mempolicy_home_node")

This commit does not apply to 6.1.y at all :(

sorry,

greg k-h

#3 lore raw
Quoted 22 lines · Greg KH
Quoted 21 lines · Liam R. Howlett

Added Michal to the Cc as I'm referencing his patch below.

Quoted 16 lines · * [email protected] <[email protected]> [231027 08:14]:

The patch below does not apply to the 6.1-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

To reproduce the conflict and resubmit, you may use the following commands:

git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.1.y
git checkout FETCH_HEAD
git cherry-pick -x 51f625377561e5b167da2db5aafb7ee268f691c5
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2023102704-surrogate-dole-2888@gregkh' --subject-prefix 'PATCH 6.1.y' HEAD^..

Possible dependencies:

Quoted 9 lines
Quoted 6 lines

Can we add this patch to the dependency list? It will allow my patch to be applied cleanly, and looks like it is close to a valid backport itself.

e976936cfc66 ("mm/mempolicy: do not duplicate policy if it is not applicable for set_mempolicy_home_node")

This commit does not apply to 6.1.y at all :(

Sorry about that. Yes, it looks like it is probably easier to re-work my patch. I'll take a closer look.

Thanks,
Liam

#4 lore raw
In reply to Liam R. Howlett
Quoted 21 lines · Liam R. Howlett

Added Michal to the Cc as I'm referencing his patch below.

Quoted 8 lines · * [email protected] <[email protected]> [231027 08:14]:

The patch below does not apply to the 6.1-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

To reproduce the conflict and resubmit, you may use the following commands:

Quoted 8 lines

git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.1.y
git checkout FETCH_HEAD
git cherry-pick -x 51f625377561e5b167da2db5aafb7ee268f691c5
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2023102704-surrogate-dole-2888@gregkh' --subject-prefix 'PATCH 6.1.y' HEAD^..

Possible dependencies:

Quoted 8 lines

Can we add this patch to the dependency list? It will allow my patch to be applied cleanly, and looks like it is close to a valid backport itself.

e976936cfc66 ("mm/mempolicy: do not duplicate policy if it is not applicable for set_mempolicy_home_node")

If you don't agree, I can rework my patch to work without it.

No objection from me. The patch is really straightforward and shouldn't pose an additional risk

Signature · 2 lines
Michal Hocko
SUSE Labs
#5 lore raw

PATCH 1/1 mm/mempolicy: fix set_mempolicy_home_node() previous VMA pointer

In reply to [email protected]

commit 51f625377561e5b167da2db5aafb7ee268f691c5 upstream.

The two users of mbind_range() are expecting that mbind_range() will update the pointer to the previous VMA, or return an error. However, set_mempolicy_home_node() does not call mbind_range() if there is no VMA policy. The fix is to update the pointer to the previous VMA prior to continuing iterating the VMAs when there is no policy.

Users may experience a WARN_ON() during VMA policy updates when updating a range of VMAs on the home node.

---
 mm/mempolicy.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
mm/mempolicy.c +3 -1
index bfe2d1d50fbe..84e11c2caae4 100644
@@ -1525,8 +1525,10 @@ SYSCALL_DEFINE4(set_mempolicy_home_node, unsigned long, start, unsigned long, le
 		/*
 		 * Only update home node if there is an existing vma policy
 		 */
-		if (!new)
+		if (!new) {
+			prev = vma;
 			continue;
+		}
 
 		/*
 		 * If any vma in the range got policy other than MPOL_BIND
Signature · 1 line
2.40.1