mm/mremap: thread state through move page table operation
authorLorenzo Stoakes <lorenzo.stoakes@oracle.com>
Mon, 10 Mar 2025 20:50:40 +0000 (20:50 +0000)
committerAndrew Morton <akpm@linux-foundation.org>
Tue, 18 Mar 2025 05:06:42 +0000 (22:06 -0700)
commit664dc4da2694fa56e49dc3e4a041bcf7608a060b
tree42c62d9b9d52674225b223ecbb64158c9ac127b0
parent2a4077f49ccd6f904be6edb363714646e47292c9
mm/mremap: thread state through move page table operation

Finish refactoring the page table logic by threading the PMC state
throughout the operation, allowing us to control the operation as we go.

Additionally, update the old_addr, new_addr fields in move_page_tables()
as we progress through the process making use of the fact we have this
state object now to track this.

With these changes made, not only is the code far more readable, but we
can finally transmit state throughout the entire operation, which lays the
groundwork for sensibly making changes in future to how the mremap()
operation is performed.

Additionally take the opportunity to refactor the means of determining the
progress of the operation, abstracting this to pmc_progress() and
simplifying the logic to make it clearer what's going on.

Link: https://lkml.kernel.org/r/230dd7a2b7b01a6eef442678f284d575e800356e.1741639347.git.lorenzo.stoakes@oracle.com
Signed-off-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Reviewed-by: Vlastimil Babka <vbabka@suse.cz>
Cc: Harry Yoo <harry.yoo@oracle.com>
Cc: Liam R. Howlett <Liam.Howlett@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/internal.h
mm/mremap.c