mm-khugepaged-drop-redundant-mm_struct-pin-in-madvise_collapse.patch removed from -mm tree
The quilt patch titled
Subject: mm/khugepaged: drop redundant mm_struct pin in madvise_collapse()
has been removed from the -mm tree. Its filename was
mm-khugepaged-drop-redundant-mm_struct-pin-in-madvise_collapse.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: "Kiryl Shutsemau (Meta)" <[email protected]>
Subject: mm/khugepaged: drop redundant mm_struct pin in madvise_collapse()
Date: Wed, 14 Oct 2026 18:11:34 +0100
Patch series "mm/collapse: separate a collapse from its callers", v5.
There is no line between the collapse engine and the callers that ask for a collapse. khugepaged.c holds both, and they reach into each other.
- Sixteen tests through the collapse path read cc->is_khugepaged to work out what they are allowed to do, when every one of those decisions was made by the caller before it asked.
- collapse_single_pmd() does both halves of a collapse behind one call. Where it gives up mmap_lock between them is buried in the anonymous scan on one side and ahead of the file scan on the other.
Start drawing the line. The caller states what it allows in a policy, and the collapse code reads the policy instead of asking who called. The scan of a PTE table and the collapse that follows get a function each, with the mmap_lock drop between them in one place.
This patch (of 9):
madvise_collapse() holds an mmgrab() reference across its work. It is redundant. Every caller already holds mm_users:
- madvise(2) works on current->mm, which lives as long as the task is in the syscall;
- process_madvise(2) reaches a remote mm through mm_access(), which takes an mm_users reference and holds it until the syscall returns;
- io_uring passes current->mm;
- DAMON takes one with get_task_mm() and drops it after the call.
Drop the mmgrab()/mmdrop() pair.
---
mm/khugepaged.c | 2 -- 1 file changed, 2 deletions(-)
mm/khugepaged.c renamed from mm/khugepaged.c~mm-khugepaged-drop-redundant-mm_struct-pin-in-madvise_collapse +0 -2
@@ -3255,7 +3255,6 @@ int madvise_collapse(struct vm_area_stru cc->is_khugepaged = false; cc->progress =0 ; -mmgrab (mm);lru_add_drain_all ();for (addr = hstart; addr < hend; addr +=HPAGE_PMD_SIZE ) {
@@ -3311,7 +3310,6 @@ out_maybelock: } out_nolock:mmap_assert_locked (mm); -mmdrop (mm);kfree (cc); return thps == ((hend - hstart) >> HPAGE_PMD_SHIFT) ? 0
_
Patches currently in -mm which might be from [email protected] are