[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <38628bf6-1676-409a-9712-15095eec8dc1@suse.cz>
Date: Mon, 10 Mar 2025 18:52:25 +0100
From: Vlastimil Babka <vbabka@...e.cz>
To: Lorenzo Stoakes <lorenzo.stoakes@...cle.com>,
Andrew Morton <akpm@...ux-foundation.org>
Cc: "Liam R . Howlett" <Liam.Howlett@...cle.com>, Jann Horn
<jannh@...gle.com>, linux-mm@...ck.org, linux-kernel@...r.kernel.org,
Harry Yoo <harry.yoo@...cle.com>, Yosry Ahmed <yosry.ahmed@...ux.dev>
Subject: Re: [PATCH v2 7/7] mm/mremap: thread state through move page table
operation
On 3/6/25 11:34, Lorenzo Stoakes wrote:
> 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.
>
> Signed-off-by: Lorenzo Stoakes <lorenzo.stoakes@...cle.com>
Reviewed-by: Vlastimil Babka <vbabka@...e.cz>
Small nit:
>
> +/*
> + * Should move_pgt_entry() acquire the rmap locks? This is either expressed in
> + * the PMC, or overridden in the case of normal, larger page tables.
> + */
> +static bool should_take_rmap_locks(struct pagetable_move_control *pmc,
> + enum pgt_entry entry)
> +{
> + if (pmc->need_rmap_locks)
> + return true;
> +
> + switch (entry) {
> + case NORMAL_PMD:
> + case NORMAL_PUD:
> + return true;
> + default:
> + return false;
> + }
> +}
> +
IMHO the "overriden" logic would be more obvious if we removed the initial
"if" and just had default: return pmc->need_rmap_locks
Powered by blists - more mailing lists