zsmalloc: use copy_page for full page copy
PATCH 1/1 zsmalloc: use copy_page for full page copy
Some architectures have implemented optimizedcopy_page for full page copying, such as arm.
On my arm platform, use the copy_page helper for single page copying is about 10 percent faster than memcpy.
--- mm/zsmalloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/zsmalloc.c +1 -1
@@ -1839,7 +1839,7 @@ static int zs_page_migrate(struct page *newpage, struct page *page,* Here, any user cannot access all objects in the zspage so let's move. */ d_addr =kmap_atomic (newpage); -memcpy (d_addr, s_addr,PAGE_SIZE ); +copy_page (d_addr, s_addr);kunmap_atomic (d_addr); for (addr = s_addr + offset; addr < s_addr + PAGE_SIZE;
Signature · 1 line
2.18.0
Quoted 8 lines · Mark-PK Tsai
Some architectures have implemented optimized
copy_pagefor full page copying, such as arm.On my arm platform, use the
copy_pagehelper for single page copying is about 10 percent faster than memcpy.Signed-off-by Mark-PK Tsai <[email protected]>
TIL
I've never heard of arm's copy_page() before. Is it really much faster than memcpy()?
mm/zsmalloc.c static int zs_page_migrate(struct page *newpage, struct page *page, · line 1842
Quoted 10 lines
mm/zsmalloc.c +1
-1@@ -1839,7 +1839,7 @@ static int zs_page_migrate(struct page *newpage, struct page *page,* Here, any user cannot access all objects in the zspage so let's move. */ d_addr =kmap_atomic (newpage); -memcpy (d_addr, s_addr,PAGE_SIZE ); +copy_page (d_addr, s_addr);
I guess you can also look into patching zram_drv.c, which seem to have at least one PAGE_SIZE memcpy().
Quoted 12 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 have implemented optimized
copy_pagefor full page copying, such as arm.On my arm platform, use the
copy_pagehelper for single page copying is about 10 percent faster than memcpy.
Quoted 6 lines
Quoted 1 line
Signed-off-by Mark-PK Tsai <[email protected]>TIL
I've never heard of arm's
copy_page()before. Is it really much faster thanmemcpy()?
Based on my earlier tests, it seems better than memcpy for full page copying.
The test code is just measures the copying time with irq disabled.
Quoted 12 lines
Reviewed-by Sergey Senozhatsky <[email protected]>mm/zsmalloc.c static int zs_page_migrate(struct page
Quoted 5 lines
mm/zsmalloc.c +0
-0@@ -1839,7 +1839,7 @@ static int zs_page_migrate(struct page*newpage, struct page *page,
mm/zsmalloc.c static int zs_page_migrate(struct page · line 1839
Quoted 1 line
mm/zsmalloc.c +0
-0* Here, any user cannot access all objects in the zspage so let's move.
Quoted 8 lines
mm/zsmalloc.c static int zs_page_migrate(struct page *newpage, struct page *page, · line 1842
Quoted 4 lines
mm/zsmalloc.c +1
-1*/ d_addr =kmap_atomic (newpage); -memcpy (d_addr, s_addr,PAGE_SIZE ); +copy_page (d_addr, s_addr);I guess you can also look into patching
zram_drv.c, which seem to have
at least onePAGE_SIZEmemcpy().
Thank. I've just post another patch for zram_drv.c as below link.