linux-staging.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH] drivers/target: Call page_address() on page acquired with GFP_KERNEL flag
@ 2023-06-14 16:44 Sumitra Sharma
  2023-06-26 20:22 ` Ira Weiny
  0 siblings, 1 reply; 2+ messages in thread
From: Sumitra Sharma @ 2023-06-14 16:44 UTC (permalink / raw)
  To: Forest Bond, Greg Kroah-Hartman, linux-staging, linux-kernel
  Cc: Ira Weiny, Fabio, Deepak R Varma, Sumitra Sharma

rd_allocate_sgl_table() acquires a page with alloc_pages(GFP_KERNEL, 0).
Pages allocated with GFP_KERNEL cannot come from Highmem. This is why
there is no need to call kmap() on them.

Therefore, use a plain page_address() on that page.

Signed-off-by: Sumitra Sharma <sumitraartsy@gmail.com>
---
 drivers/target/target_core_rd.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/target/target_core_rd.c b/drivers/target/target_core_rd.c
index 6648c1c90e19..d8ea6aff39a2 100644
--- a/drivers/target/target_core_rd.c
+++ b/drivers/target/target_core_rd.c
@@ -159,9 +159,8 @@ static int rd_allocate_sgl_table(struct rd_dev *rd_dev, struct rd_dev_sg_table *
 			sg_assign_page(&sg[j], pg);
 			sg[j].length = PAGE_SIZE;
 
-			p = kmap(pg);
+			p = page_address(pg);
 			memset(p, init_payload, PAGE_SIZE);
-			kunmap(pg);
 		}
 
 		page_offset += sg_per_table;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] drivers/target: Call page_address() on page acquired with GFP_KERNEL flag
  2023-06-14 16:44 [PATCH] drivers/target: Call page_address() on page acquired with GFP_KERNEL flag Sumitra Sharma
@ 2023-06-26 20:22 ` Ira Weiny
  0 siblings, 0 replies; 2+ messages in thread
From: Ira Weiny @ 2023-06-26 20:22 UTC (permalink / raw)
  To: Sumitra Sharma, Forest Bond, Greg Kroah-Hartman, linux-staging,
	linux-kernel
  Cc: Ira Weiny, Fabio, Deepak R Varma, Sumitra Sharma

Sumitra Sharma wrote:
> rd_allocate_sgl_table() acquires a page with alloc_pages(GFP_KERNEL, 0).
> Pages allocated with GFP_KERNEL cannot come from Highmem. This is why
> there is no need to call kmap() on them.
> 
> Therefore, use a plain page_address() on that page.
> 
> Signed-off-by: Sumitra Sharma <sumitraartsy@gmail.com>

LGTM:

Reviewed-by: Ira Weiny <ira.weiny@intel.com>

> ---
>  drivers/target/target_core_rd.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/target/target_core_rd.c b/drivers/target/target_core_rd.c
> index 6648c1c90e19..d8ea6aff39a2 100644
> --- a/drivers/target/target_core_rd.c
> +++ b/drivers/target/target_core_rd.c
> @@ -159,9 +159,8 @@ static int rd_allocate_sgl_table(struct rd_dev *rd_dev, struct rd_dev_sg_table *
>  			sg_assign_page(&sg[j], pg);
>  			sg[j].length = PAGE_SIZE;
>  
> -			p = kmap(pg);
> +			p = page_address(pg);
>  			memset(p, init_payload, PAGE_SIZE);
> -			kunmap(pg);
>  		}
>  
>  		page_offset += sg_per_table;
> -- 
> 2.25.1
> 



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-06-26 20:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-14 16:44 [PATCH] drivers/target: Call page_address() on page acquired with GFP_KERNEL flag Sumitra Sharma
2023-06-26 20:22 ` Ira Weiny

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).