]> www.infradead.org Git - users/jedix/linux-maple.git/commit
mm/mremap: refactor move_page_tables(), abstracting state
authorLorenzo Stoakes <lorenzo.stoakes@oracle.com>
Mon, 3 Mar 2025 11:08:36 +0000 (11:08 +0000)
committerAndrew Morton <akpm@linux-foundation.org>
Tue, 4 Mar 2025 05:50:49 +0000 (21:50 -0800)
commit22f79b3b21dd3ab63be51d22b6a86e8074b9dbb6
tree377555af6de1610d20fefabb73743e919579881d
parent95a64d2e7de53a756c4072ef61dea8d2c1aa8001
mm/mremap: refactor move_page_tables(), abstracting state

A lot of state is threaded throughout the page table moving logic within
the mremap code, including boolean values which control behaviour
specifically in regard to whether rmap locks need be held over the
operation and whether the VMA belongs to a temporary stack being moved by
move_arg_pages() (and consequently, relocate_vma_down()).

As we already transmit state throughout this operation, it is neater and
more readable to maintain a small state object.  We do so in the form of
pagetable_move_control.

In addition, this allows us to update parameters within the state as we
manipulate things, for instance with regard to the page table realignment
logic.

In future I want to add additional functionality to the page table logic,
so this is an additional motivation for making it easier to do so.

This patch changes move_page_tables() to accept a pointer to a
pagetable_move_control struct, and performs changes at this level only.
Further page table logic will be updated in a subsequent patch.

We additionally also take the opportunity to add significant comments
describing the address realignment logic to make it abundantly clear what
is going on in this code.

Link: https://lkml.kernel.org/r/1afa8a1a40277aa4cfd595c50f5fa85ea3839813.1740911247.git.lorenzo.stoakes@oracle.com
Signed-off-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Cc: Harry Yoo <harry.yoo@oracle.com>
Cc: Jann Horn <jannh@google.com>
Cc: Liam Howlett <liam.howlett@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/internal.h
mm/mmap.c
mm/mremap.c