linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Pintu Kumar <quic_pintu@quicinc.com>
Cc: minchan@kernel.org, senozhatsky@chromium.org,
	akpm@linux-foundation.org, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org, joe@perches.com,
	skhan@linuxfoundation.org, pintu.ping@gmail.com
Subject: Re: [PATCH 3/3] zsmalloc: replace kmap_atomic with kmap_local_page
Date: Wed, 2 Oct 2024 04:38:21 +0100	[thread overview]
Message-ID: <ZvzALYgWMSUYXsol@casper.infradead.org> (raw)
In-Reply-To: <20241001175358.12970-1-quic_pintu@quicinc.com>

On Tue, Oct 01, 2024 at 11:23:58PM +0530, Pintu Kumar wrote:
> @@ -1059,12 +1061,12 @@ static void *__zs_map_object(struct mapping_area *area,
>  	sizes[1] = size - sizes[0];
>  
>  	/* copy object to per-cpu buffer */
> -	addr = kmap_atomic(pages[0]);
> +	addr = kmap_local_page(pages[0]);
>  	memcpy(buf, addr + off, sizes[0]);
> -	kunmap_atomic(addr);
> -	addr = kmap_atomic(pages[1]);
> +	kunmap_local(addr);
> +	addr = kmap_local_page(pages[1]);
>  	memcpy(buf + sizes[0], addr, sizes[1]);
> -	kunmap_atomic(addr);
> +	kunmap_local(addr);

This looks like memcpy_from_page().

>  	/* copy per-cpu buffer to object */
> -	addr = kmap_atomic(pages[0]);
> +	addr = kmap_local_page(pages[0]);
>  	memcpy(addr + off, buf, sizes[0]);
> -	kunmap_atomic(addr);
> -	addr = kmap_atomic(pages[1]);
> +	kunmap_local(addr);
> +	addr = kmap_local_page(pages[1]);
>  	memcpy(addr, buf + sizes[0], sizes[1]);
> -	kunmap_atomic(addr);
> +	kunmap_local(addr);

memcpy_from_page()?

> @@ -1798,14 +1800,14 @@ static int zs_page_migrate(struct page *newpage, struct page *page,
>  	migrate_write_lock(zspage);
>  
>  	offset = get_first_obj_offset(page);
> -	s_addr = kmap_atomic(page);
> +	s_addr = kmap_local_page(page);
>  
>  	/*
>  	 * Here, any user cannot access all objects in the zspage so let's move.
>  	 */
> -	d_addr = kmap_atomic(newpage);
> +	d_addr = kmap_local_page(newpage);
>  	copy_page(d_addr, s_addr);
> -	kunmap_atomic(d_addr);
> +	kunmap_local(d_addr);

copy_highpage()?


Maybe check the other uses, see if there are appropriate helpers for
them too.

Also, what testing have you done of this patch?


  parent reply	other threads:[~2024-10-02  3:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-01 17:53 Pintu Kumar
2024-10-02  3:18 ` Sergey Senozhatsky
2024-10-03 16:55   ` Pintu Agarwal
2024-10-02  3:38 ` Matthew Wilcox [this message]
2024-10-03 18:07   ` Pintu Agarwal

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=ZvzALYgWMSUYXsol@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=minchan@kernel.org \
    --cc=pintu.ping@gmail.com \
    --cc=quic_pintu@quicinc.com \
    --cc=senozhatsky@chromium.org \
    --cc=skhan@linuxfoundation.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