From: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: "Liam R . Howlett" <Liam.Howlett@oracle.com>,
Vlastimil Babka <vbabka@suse.cz>, Jann Horn <jannh@google.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: [PATCH 0/7] refactor mremap and fix bug
Date: Mon, 3 Mar 2025 11:08:30 +0000 [thread overview]
Message-ID: <cover.1740911247.git.lorenzo.stoakes@oracle.com> (raw)
The existing mremap() logic has grown organically over a very long period
of time, resulting in code that is in many parts, very difficult to follow
and full of subtleties and sources of confusion.
In addition, it is difficult to thread state through the operation
correctly, as function arguments have expanded, some parameters are
expected to be temporarily altered during the operation, others are
intended to remain static and some can be overridden.
This series completely refactors the mremap implementation, sensibly
separating functions, adding comments to explain the more subtle aspects of
the implementation and making use of small structs to thread state through
everything.
The reason for doing so is to lay the groundwork for planned future changes
to the mremap logic, changes which require the ability to easily pass
around state.
Additionally, it would be unhelpful to add yet more logic to code that is
already difficult to follow without first refactoring it like this.
The first patch in this series additionally fixes a bug when a VMA with
start address zero is partially remapped.
Tested on real hardware under heavy workload and all self tests are
passing.
Lorenzo Stoakes (7):
mm/mremap: correctly handle partial mremap() of VMA starting at 0
mm/mremap: refactor mremap() system call implementation
mm/mremap: introduce and use vma_remap_struct threaded state
mm/mremap: initial refactor of move_vma()
mm/mremap: complete refactor of move_vma()
mm/mremap: refactor move_page_tables(), abstracting state
mm/mremap: thread state through move page table operation
mm/internal.h | 49 +-
mm/mmap.c | 5 +-
mm/mremap.c | 1440 +++++++++++++++++++++++++++++++++----------------
3 files changed, 1033 insertions(+), 461 deletions(-)
--
2.48.1
next reply other threads:[~2025-03-03 11:08 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-03 11:08 Lorenzo Stoakes [this message]
2025-03-03 11:08 ` [PATCH 1/7] mm/mremap: correctly handle partial mremap() of VMA starting at 0 Lorenzo Stoakes
2025-03-03 13:26 ` Harry Yoo
2025-03-03 16:09 ` Liam R. Howlett
2025-03-05 11:50 ` Vlastimil Babka
2025-03-05 19:46 ` Lorenzo Stoakes
2025-03-03 11:08 ` [PATCH 2/7] mm/mremap: refactor mremap() system call implementation Lorenzo Stoakes
2025-03-03 17:12 ` Liam R. Howlett
2025-03-03 17:20 ` Lorenzo Stoakes
2025-03-03 18:50 ` Liam R. Howlett
2025-03-05 1:47 ` Harry Yoo
2025-03-05 11:23 ` Lorenzo Stoakes
2025-03-03 11:08 ` [PATCH 3/7] mm/mremap: introduce and use vma_remap_struct threaded state Lorenzo Stoakes
2025-03-05 18:52 ` Liam R. Howlett
2025-03-05 19:43 ` Lorenzo Stoakes
2025-03-05 19:55 ` Liam R. Howlett
2025-03-03 11:08 ` [PATCH 4/7] mm/mremap: initial refactor of move_vma() Lorenzo Stoakes
2025-03-04 21:45 ` Yosry Ahmed
2025-03-04 23:15 ` Andrew Morton
2025-03-05 19:20 ` Liam R. Howlett
2025-03-05 20:01 ` Lorenzo Stoakes
2025-03-03 11:08 ` [PATCH 5/7] mm/mremap: complete " Lorenzo Stoakes
2025-03-03 11:08 ` [PATCH 6/7] mm/mremap: refactor move_page_tables(), abstracting state Lorenzo Stoakes
2025-03-03 11:08 ` [PATCH 7/7] mm/mremap: thread state through move page table operation Lorenzo Stoakes
2025-03-03 23:17 ` kernel test robot
2025-03-03 23:30 ` kernel test robot
2025-03-04 0:05 ` Andrew Morton
2025-03-04 0:12 ` Andrew Morton
2025-03-04 5:40 ` Lorenzo Stoakes
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=cover.1740911247.git.lorenzo.stoakes@oracle.com \
--to=lorenzo.stoakes@oracle.com \
--cc=Liam.Howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=jannh@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=vbabka@suse.cz \
/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