[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZvzALYgWMSUYXsol@casper.infradead.org>
Date: Wed, 2 Oct 2024 04:38:21 +0100
From: Matthew Wilcox <willy@...radead.org>
To: Pintu Kumar <quic_pintu@...cinc.com>
Cc: minchan@...nel.org, senozhatsky@...omium.org, akpm@...ux-foundation.org,
linux-mm@...ck.org, linux-kernel@...r.kernel.org, joe@...ches.com,
skhan@...uxfoundation.org, pintu.ping@...il.com
Subject: Re: [PATCH 3/3] zsmalloc: replace kmap_atomic with kmap_local_page
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?
Powered by blists - more mailing lists