[merged mm-stable] mm-ksm-initialize-the-addr-only-once-in-collect_procs_ksm.patch removed from -mm tree
Andrew Morton <[email protected]> Tue, 04 Aug 2026 19:24:48 -0700
| Newsgroups | org.kernel.vger.mm-commits |
|---|---|
| Message-ID | <[email protected]> |
The quilt patch titled
Subject: mm/ksm: initialize the addr only once in collect_procs_ksm
has been removed from the -mm tree. Its filename was
mm-ksm-initialize-the-addr-only-once-in-collect_procs_ksm.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: xu xin <[email protected]>
Subject: mm/ksm: initialize the addr only once in collect_procs_ksm
Date: Thu, 9 Jul 2026 17:32:12 +0800 (CST)
Patch series "KSM: use linear_page_index in collect_procs_ksm()", v2.
In collect_procs_ksm() which is used to collect processes when the error
hit an ksm page, there is the same issue with rmap_walk_ksm (see the
previous discussion at [1]). So we apply the similar logic changes to the
collect_procs_ksm().
The patch [1/2] move the initializaion of addr from the position inside
loop to the position before the loop, since the variable will not change
in the loop.
The patch [2/2] optimize collect_procs_ksm by passing a suitable page
offset range to the anon_vma_interval_tree_foreach loop to reduce
ineffective checks.
This patch (of 2):
Similar to 318d87b8fa7 ("ksm: initialize the addr only once in
rmap_walk_ksm"), only initialize the addr once in rmap_walk_ksm because
the addr variable doesn't change across iterations.
Link: https://lore.kernel.org/[email protected]
Link: https://lore.kernel.org/all/[email protected]/ [1]
Signed-off-by: xu xin <[email protected]>
Acked-by: David Hildenbrand (Arm) <[email protected]>
Cc: Chengming Zhou <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
---
mm/ksm.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
--- a/mm/ksm.c~mm-ksm-initialize-the-addr-only-once-in-collect_procs_ksm
+++ a/mm/ksm.c
@@ -3289,7 +3289,7 @@ void collect_procs_ksm(const struct foli
rcu_read_lock();
for_each_process(tsk) {
struct anon_vma_chain *vmac;
- unsigned long addr;
+ const unsigned long addr = rmap_item->address & PAGE_MASK;
struct task_struct *t =
task_early_kill(tsk, force_early);
if (!t)
@@ -3299,7 +3299,6 @@ void collect_procs_ksm(const struct foli
{
vma = vmac->vma;
if (vma->vm_mm == t->mm) {
- addr = rmap_item->address & PAGE_MASK;
add_to_kill_ksm(t, page, vma, to_kill,
addr);
}
_
Patches currently in -mm which might be from [email protected] are
mm-mm_sloth-add-a-helper-function-mm_slot_remove.patch
mm-mm_sloth-add-comments-for-mm_slot_lookup-insert.patch