Skip to contentSkip to conversation

zram: use copy_page for full page copy

PATCH Applied Mark-PK Tsai 2 participants 5 messages Oct 7, 2023 – Feb 5, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 zram: use copy_page for full page copy

Some architectures, such as arm, have implemented
optimized copy_page for full page copying.

Replace the full page memcpy with copy_page to
take advantage of the optimization.

---
 drivers/block/zram/zram_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/block/zram/zram_drv.c +1 -1
index d77d3664ca08..58700dd73d1d 100644
@@ -1338,7 +1338,7 @@ static int zram_read_from_zspool(struct zram *zram, struct page *page,
 	src = zs_map_object(zram->mem_pool, handle, ZS_MM_RO);
 	if (size == PAGE_SIZE) {
 		dst = kmap_atomic(page);
-		memcpy(dst, src, PAGE_SIZE);
+		copy_page(dst, src);
 		kunmap_atomic(dst);
 		ret = 0;
 	} else {
Signature · 1 line
2.18.0
#2 lore raw
Quoted 8 lines · Sergey Senozhatsky

External email : Please do not click links or open attachments until you have verified the sender or the content.

Quoted 4 lines · Mark-PK Tsai

Some architectures, such as arm, have implemented
optimized copy_page for full page copying.

Quoted 6 lines
Quoted 4 lines

Replace the full page memcpy with copy_page to
take advantage of the optimization.

I guess this patch may have been overlooked.
Could someone please help to review it?

Thanks,
Mark

#3 lore raw
Quoted 12 lines · Mark-PK Tsai (蔡沛剛)
Quoted 11 lines · Sergey Senozhatsky

External email : Please do not click links or open attachments until you have verified the sender or the content.

Quoted 7 lines · Mark-PK Tsai

Some architectures, such as arm, have implemented
optimized copy_page for full page copying.

Replace the full page memcpy with copy_page to
take advantage of the optimization.

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

I guess this patch may have been overlooked.
Could someone please help to review it?

Oh, yes. Let me take care of that.

maintainer Reviewed-by on v1 1/1
#4 lore raw
In reply to Mark-PK Tsai

Cc-ing Andrew on this

Quoted 7 lines · Mark-PK Tsai

Some architectures, such as arm, have implemented
optimized copy_page for full page copying.

Replace the full page memcpy with copy_page to
take advantage of the optimization.

Quoted 19 lines
---
 drivers/block/zram/zram_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/block/zram/zram_drv.c +1 -1
index d77d3664ca08..58700dd73d1d 100644
@@ -1338,7 +1338,7 @@ static int zram_read_from_zspool(struct zram *zram, struct page *page,
 	src = zs_map_object(zram->mem_pool, handle, ZS_MM_RO);
 	if (size == PAGE_SIZE) {
 		dst = kmap_atomic(page);
-		memcpy(dst, src, PAGE_SIZE);
+		copy_page(dst, src);
 		kunmap_atomic(dst);
 		ret = 0;
 	} else {
Signature · 1 line
2.18.0