Re: [PATCH 3/3] zsmalloc: replace kmap_atomic with kmap_local_page

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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?




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux