Skip to content

Commit

Permalink
mm/mremap: thread state through move page table operation
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Lorenzo Stoakes authored and Andrew Morton committed Mar 18, 2025
1 parent 2a4077f commit 664dc4d
Show file tree
Hide file tree
Showing 2 changed files with 116 additions and 83 deletions.
3 changes: 3 additions & 0 deletions mm/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ struct folio_batch;
*
* Use the PAGETABLE_MOVE() macro to initialise this struct.
*
* The old_addr and new_addr fields are updated as the page table move is
* executed.
*
* NOTE: The page table move is affected by reading from [old_addr, old_end),
* and old_addr may be updated for better page table alignment, so len_in
* represents the length of the range being copied as specified by the user.
Expand Down
Loading

0 comments on commit 664dc4d

Please sign in to comment.