linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "liying3@sungrowpower.com" <liying3@sungrowpower.com>
To: akpm <akpm@linux-foundation.org>
Cc: linux-mm <linux-mm@kvack.org>,
	 linux-kernel <linux-kernel@vger.kernel.org>,
	 victor7q <victor7q@163.com>
Subject: [BUG] mm/mempolicy: possible double-unlock in migrate_to_node() on 6.6
Date: Tue, 3 Mar 2026 10:52:51 +0800	[thread overview]
Message-ID: <2026030310525141773825@sungrowpower.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1300 bytes --]

Hi Andrew,

I found that a fix is required for this submission in branch 6.6.
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=a13b2b9b0b0b04612c7d81e3b3dfb485c5f7abc3 

Regarding the difference between branches 6.6 and 6.12, in branch 6.6, mmap_read_lock() and mmap_read_unlock() are called outside the migrate_to_node() function. 
Therefore, mmap_read_unlock(mm) should not be invoked inside migrate_to_node(); otherwise, it would result in a double unlock of the mm.
diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index 54f1b78d1b2c0f..94c74c594d102a 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -1071,6 +1071,10 @@ static long migrate_to_node(struct mm_struct *mm, int source, int dest,
VM_BUG_ON(!(flags & (MPOL_MF_MOVE | MPOL_MF_MOVE_ALL)));
vma = find_vma(mm, 0);
+ if (unlikely(!vma)) {
+ mmap_read_unlock(mm); // this line should be deleted
+ return 0;
+ }
/*
* This does not migrate the range, but isolates all pages that



Best Regards,
Li Ying , Light Storage Group.  Senior Embedded Software Engineer
Tel: -; Fax: -
Mobile: +86-15651963981
liying3@sungrowpower.com 
www.sungrowpower.com
SUNGROW POWER SUPPLY Co., Ltd. 
Add: No.1699 Xiyou Rd., New & High Technology Industrial Development Zone, Hefei, P. R. China., 230088

[-- Attachment #2: Type: text/html, Size: 55196 bytes --]

             reply	other threads:[~2026-03-03  2:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-03  2:52 liying3 [this message]
2026-03-03  4:15 ` Matthew Wilcox

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=2026030310525141773825@sungrowpower.com \
    --to=liying3@sungrowpower.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=victor7q@163.com \
    /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