mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: "Vishal Moola (Oracle)" <vishal.moola@gmail.com>, linux-mm@kvack.org
Cc: linux-kernel@vger.kernel.org,
	"Matthew Wilcox (Oracle)" <willy@infradead.org>,
	Jordan Rome <linux@jordanrome.com>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH 1/3] mm/memory.c: Use folios in __copy_remote_vm_str()
Date: Fri, 11 Jul 2025 12:49:25 +0200	[thread overview]
Message-ID: <faa3d518-cd0f-4848-b4c7-deaad02bd0fd@redhat.com> (raw)
In-Reply-To: <20250709194017.927978-4-vishal.moola@gmail.com>

On 09.07.25 21:40, Vishal Moola (Oracle) wrote:
> Use kmap_local_folio() instead of kmap_local_page().
> Replaces 2 calls to compound_head() from unmap_and_put_page() with one.
> 
> This prepares us for the removal of unmap_and_put_page().
> 
> Signed-off-by: Vishal Moola (Oracle) <vishal.moola@gmail.com>
> ---
>   mm/memory.c | 8 +++++---
>   1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/mm/memory.c b/mm/memory.c
> index 1174f3001307..d63f0d5abcc9 100644
> --- a/mm/memory.c
> +++ b/mm/memory.c
> @@ -6815,6 +6815,7 @@ static int __copy_remote_vm_str(struct mm_struct *mm, unsigned long addr,
>   	while (len) {
>   		int bytes, offset, retval;
>   		void *maddr;
> +		struct folio *folio;
>   		struct page *page;
>   		struct vm_area_struct *vma = NULL;
>   
> @@ -6830,17 +6831,18 @@ static int __copy_remote_vm_str(struct mm_struct *mm, unsigned long addr,
>   			goto out;
>   		}
>   
> +		folio = page_folio(page);
>   		bytes = len;
>   		offset = addr & (PAGE_SIZE - 1);
>   		if (bytes > PAGE_SIZE - offset)
>   			bytes = PAGE_SIZE - offset;
>   
> -		maddr = kmap_local_page(page);
> +		maddr = kmap_local_folio(folio, folio_page_idx(folio, page) * PAGE_SIZE);

It's weird to go page -> folio -> page ... but maybe that's just the way 
it's supposed to work here ...

:)

Acked-by: David Hildenbrand <david@redhat.com>

-- 
Cheers,

David / dhildenb


  reply	other threads:[~2025-07-11 10:49 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-09 19:40 [PATCH 0/3] Remove unmap_and_put_page() Vishal Moola (Oracle)
2025-07-09 19:40 ` [PATCH 1/3] mm/memory.c: Use folios in __copy_remote_vm_str() Vishal Moola (Oracle)
2025-07-11 10:49   ` David Hildenbrand [this message]
2025-07-09 19:40 ` [PATCH 2/3] mm/memory.c: Use folios in __access_remote_vm() Vishal Moola (Oracle)
2025-07-11 10:50   ` David Hildenbrand
2025-07-09 19:40 ` [PATCH 3/3] mm: Remove unmap_and_put_page() Vishal Moola (Oracle)
2025-07-11 10:51   ` David Hildenbrand

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=faa3d518-cd0f-4848-b4c7-deaad02bd0fd@redhat.com \
    --to=david@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux@jordanrome.com \
    --cc=vishal.moola@gmail.com \
    --cc=willy@infradead.org \
    /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

all inboxes | Powered by JetHome®