* + mm-mremap-reaccount-on-unmap-failure-only-if-accounted.patch added to mm-new branch
@ 2026-11-06 1:27 Andrew Morton
0 siblings, 0 replies; only message in thread
From: Andrew Morton @ 2026-11-06 1:27 UTC (permalink / raw)
To: mm-commits, vbabka, sarthak.sharma, pfalcato, osalvador,
muchun.song, ljs, liam, jannh, david, azpijr, josef, akpm
The patch titled
Subject: mm/mremap: reaccount on unmap failure only if accounted
has been added to the -mm mm-new branch. Its filename is
mm-mremap-reaccount-on-unmap-failure-only-if-accounted.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-mremap-reaccount-on-unmap-failure-only-if-accounted.patch
This patch will later appear in the mm-new branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Note, mm-new is a provisional staging ground for work-in-progress
patches, and acceptance into mm-new is a notification for others take
notice and to finish up reviews. Please do not hesitate to respond to
review feedback and post updated versions to replace or incrementally
fixup patches in mm-new.
The mm-new branch of mm.git is not included in linux-next
If a few days of testing in mm-new is successful, the patch will me moved
into mm.git's mm-unstable branch, which is included in linux-next
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next via various
branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days
------------------------------------------------------
From: Josef Bacik <josef@toxicpanda.com>
Subject: mm/mremap: reaccount on unmap failure only if accounted
Date: Thu, 05 Nov 2026 14:02:05 +0000
When the unmap of the source range fails at the end of an mremap() move,
the length of the range is charged to vm_committed_as even if the VMA was
never accounted, for example a MAP_SHARED or MAP_NORESERVE mapping.
Nothing ever uncharges these pages, so each such failure permanently
inflates the committed memory count.
This was reproduced with fault injection: each failure on a shmem mapping
left Committed_AS higher by the size of the moved range after everything
was unmapped.
Fix by charging the range again only when accountable_move is set.
Link: https://lore.kernel.org/20261105-b4-mremap-pre-split-v3-3-f8789de76849@toxicpanda.com
Fixes: b714ccb02a76 ("mm/mremap: complete refactor of move_vma()")
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
Reviewed-by: Jose A. Perez de Azpillaga <azpijr@gmail.com>
Cc: Liam R. Howlett <liam@infradead.org>
Cc: David Hildenbrand <david@kernel.org>
Cc: Vlastimil Babka <vbabka@kernel.org>
Cc: Jann Horn <jannh@google.com>
Cc: Pedro Falcato <pfalcato@suse.de>
Cc: Muchun Song <muchun.song@linux.dev>
Cc: Oscar Salvador <osalvador@suse.de>
Cc: Sarthak Sharma <sarthak.sharma@arm.com>
---
mm/mremap.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--- a/mm/mremap.c~mm-mremap-reaccount-on-unmap-failure-only-if-accounted
+++ a/mm/mremap.c
@@ -1246,7 +1246,8 @@ static void unmap_source_vma(struct vma_
vrm->vmi_needs_invalidate = true;
if (err) {
/* OOM: unable to split vma, just get accounts right */
- vm_acct_memory(len >> PAGE_SHIFT);
+ if (accountable_move)
+ vm_acct_memory(len >> PAGE_SHIFT);
return;
}
_
Patches currently in -mm which might be from josef@toxicpanda.com are
mm-zswap-drop-the-stale-zswap-entry-of-a-zero-folio.patch
mm-swap-account-synchronous-swap-reads-as-memory-stall.patch
mm-mremap-fix-hugetlb-reservation-leak-on-partial-move.patch
selftests-mm-test-a-partial-mremap-of-hugetlb-memory.patch
mm-mremap-reaccount-on-unmap-failure-only-if-accounted.patch
mm-mremap-restore-vma_account_bit-if-the-unmap-fails.patch
selftests-mm-test-mremap-with-an-old-size-of-0.patch
zram-lz4-lz4hc-accept-dictionaries-of-more-than-64-kib.patch
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-06 1:27 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-06 1:27 + mm-mremap-reaccount-on-unmap-failure-only-if-accounted.patch added to mm-new branch Andrew Morton
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.