From: Andrew Morton <akpm@linux-foundation.org>
To: mm-commits@vger.kernel.org,ziy@nvidia.com,vbabka@kernel.org,pfalcato@suse.de,ljs@kernel.org,liam@infradead.org,jannh@google.com,david@kernel.org,wangkefeng.wang@huawei.com,akpm@linux-foundation.org
Subject: [merged mm-stable] mm-mincore-use-per-vma-lock-during-page-table-walk.patch removed from -mm tree
Date: Mon, 12 Oct 2026 21:32:40 -0700 [thread overview]
Message-ID: <20261013043240.AB7F11F00893@smtp.kernel.org> (raw)
The quilt patch titled
Subject: mm: mincore: use per-vma lock during page table walk
has been removed from the -mm tree. Its filename was
mm-mincore-use-per-vma-lock-during-page-table-walk.patch
This patch was dropped because it was merged into the mm-stable branch
of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
------------------------------------------------------
From: Kefeng Wang <wangkefeng.wang@huawei.com>
Subject: mm: mincore: use per-vma lock during page table walk
Date: Wed, 16 Sep 2026 12:31:52 +0800
do_mincore() performs a read-only, per-VMA residency query, making it a
good candidate for per-VMA locking. Convert it to acquire the per-VMA
lock, thereby reducing contention on the per-MM mmap_lock.
Link: https://lore.kernel.org/20260916043153.2631696-1-wangkefeng.wang@huawei.com
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Pedro Falcato <pfalcato@suse.de>
Acked-by: David Hildenbrand (Arm) <david@kernel.org>
Reviewed-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
Cc: Jann Horn <jannh@google.com>
Cc: Liam R. Howlett <liam@infradead.org>
Cc: Vlastimil Babka <vbabka@kernel.org>
Cc: Zi Yan <ziy@nvidia.com>
---
mm/mincore.c | 29 +++++++++++++++++------------
1 file changed, 17 insertions(+), 12 deletions(-)
--- a/mm/mincore.c~mm-mincore-use-per-vma-lock-during-page-table-walk
+++ a/mm/mincore.c
@@ -235,24 +235,22 @@ static const struct mm_walk_ops mincore_
.pmd_entry = mincore_pte_range,
.pte_hole = mincore_unmapped_range,
.hugetlb_entry = mincore_hugetlb,
- .walk_lock = PGWALK_RDLOCK,
+ .walk_lock = PGWALK_VMA_RDLOCK_VERIFY,
};
/*
* Do a chunk of "sys_mincore()". We've already checked
- * all the arguments, we hold the mmap semaphore: we should
+ * all the arguments, we hold the VMA read lock: we should
* just return the amount of info we're asked for.
*/
-static long do_mincore(unsigned long addr, unsigned long pages, unsigned char *vec)
+static long do_mincore(struct vm_area_struct *vma, unsigned long addr,
+ unsigned long pages, unsigned char *vec)
{
- struct vm_area_struct *vma;
- unsigned long end;
+ unsigned long end = min(vma->vm_end, addr + (pages << PAGE_SHIFT));
int err;
- vma = vma_lookup(current->mm, addr);
- if (!vma)
- return -ENOMEM;
- end = min(vma->vm_end, addr + (pages << PAGE_SHIFT));
+ vma_assert_locked(vma);
+
if (!can_do_mincore(vma)) {
unsigned long pages = DIV_ROUND_UP(end - addr, PAGE_SIZE);
memset(vec, 1, pages);
@@ -319,13 +317,20 @@ SYSCALL_DEFINE3(mincore, unsigned long,
retval = 0;
while (pages) {
+ struct vm_area_struct *vma;
+
+ vma = vma_start_read_unlocked(current->mm, start);
+ if (!vma) {
+ retval = -ENOMEM;
+ break;
+ }
+
/*
* Do at most PAGE_SIZE entries per iteration, due to
* the temporary buffer size.
*/
- mmap_read_lock(current->mm);
- retval = do_mincore(start, min(pages, PAGE_SIZE), tmp);
- mmap_read_unlock(current->mm);
+ retval = do_mincore(vma, start, min(pages, PAGE_SIZE), tmp);
+ vma_end_read(vma);
if (retval <= 0)
break;
_
Patches currently in -mm which might be from wangkefeng.wang@huawei.com are
reply other threads:[~2026-10-13 4:32 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20261013043240.AB7F11F00893@smtp.kernel.org \
--to=akpm@linux-foundation.org \
--cc=david@kernel.org \
--cc=jannh@google.com \
--cc=liam@infradead.org \
--cc=ljs@kernel.org \
--cc=mm-commits@vger.kernel.org \
--cc=pfalcato@suse.de \
--cc=vbabka@kernel.org \
--cc=wangkefeng.wang@huawei.com \
--cc=ziy@nvidia.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.