linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Vlastimil Babka <vbabka@suse.cz>
To: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>,
	Andrew Morton <akpm@linux-foundation.org>
Cc: "Liam R . Howlett" <Liam.Howlett@oracle.com>,
	Jann Horn <jannh@google.com>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Harry Yoo <harry.yoo@oracle.com>,
	Yosry Ahmed <yosry.ahmed@linux.dev>
Subject: Re: [PATCH v2 7/7] mm/mremap: thread state through move page table operation
Date: Mon, 10 Mar 2025 18:52:25 +0100	[thread overview]
Message-ID: <38628bf6-1676-409a-9712-15095eec8dc1@suse.cz> (raw)
In-Reply-To: <1d85814f3a73eaa241c554b3e0f751f3e267a467.1741256580.git.lorenzo.stoakes@oracle.com>

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@oracle.com>

Reviewed-by: Vlastimil Babka <vbabka@suse.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


  reply	other threads:[~2025-03-10 17:52 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-06 10:33 [PATCH v2 0/7] refactor mremap and fix bug Lorenzo Stoakes
2025-03-06 10:33 ` [PATCH v2 1/7] mm/mremap: correctly handle partial mremap() of VMA starting at 0 Lorenzo Stoakes
2025-03-06 10:33 ` [PATCH v2 2/7] mm/mremap: refactor mremap() system call implementation Lorenzo Stoakes
2025-03-06 13:56   ` Vlastimil Babka
2025-03-06 10:33 ` [PATCH v2 3/7] mm/mremap: introduce and use vma_remap_struct threaded state Lorenzo Stoakes
2025-03-06 15:26   ` Vlastimil Babka
2025-03-10 10:19   ` Lorenzo Stoakes
2025-03-10 18:02     ` Lorenzo Stoakes
2025-03-06 10:34 ` [PATCH v2 4/7] mm/mremap: initial refactor of move_vma() Lorenzo Stoakes
2025-03-10 14:11   ` Vlastimil Babka
2025-03-10 14:28     ` Lorenzo Stoakes
2025-03-06 10:34 ` [PATCH v2 5/7] mm/mremap: complete " Lorenzo Stoakes
2025-03-10 15:11   ` Vlastimil Babka
2025-03-10 15:38     ` Lorenzo Stoakes
2025-03-06 10:34 ` [PATCH v2 6/7] mm/mremap: refactor move_page_tables(), abstracting state Lorenzo Stoakes
2025-03-10 17:05   ` Vlastimil Babka
2025-03-10 18:09     ` Lorenzo Stoakes
2025-03-06 10:34 ` [PATCH v2 7/7] mm/mremap: thread state through move page table operation Lorenzo Stoakes
2025-03-10 17:52   ` Vlastimil Babka [this message]
2025-03-10 18:13     ` 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=38628bf6-1676-409a-9712-15095eec8dc1@suse.cz \
    --to=vbabka@suse.cz \
    --cc=Liam.Howlett@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=harry.yoo@oracle.com \
    --cc=jannh@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lorenzo.stoakes@oracle.com \
    --cc=yosry.ahmed@linux.dev \
    /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