Re: [PATCH] mm/memory: Replace kmap() with kmap_local_page()

From: Ira Weiny
Date: Sun Dec 17 2023 - 22:34:30 EST


Fabio M. De Francesco wrote:

[snip]

>
> Cc: Ira Weiny <ira.weiny@xxxxxxxxx>
> Signed-off-by: Fabio M. De Francesco <fabio.maria.de.francesco@xxxxxxxxxxxxxxx>
> ---
> mm/memory.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/mm/memory.c b/mm/memory.c
> index 7d9f6b685032..88377a107fbe 100644
> --- a/mm/memory.c
> +++ b/mm/memory.c
> @@ -5852,7 +5852,7 @@ static int __access_remote_vm(struct mm_struct *mm, unsigned long addr,
> if (bytes > PAGE_SIZE-offset)
> bytes = PAGE_SIZE-offset;
>
> - maddr = kmap(page);
> + maddr = kmap_local_page(page);
> if (write) {
> copy_to_user_page(vma, page, addr,
> maddr + offset, buf, bytes);
> @@ -5861,8 +5861,7 @@ static int __access_remote_vm(struct mm_struct *mm, unsigned long addr,
> copy_from_user_page(vma, page, addr,
> buf, maddr + offset, bytes);
> }
> - kunmap(page);
> - put_page(page);
> + unmap_and_put_page(page, maddr);

Does this really have the same functionality?

Ira