lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <dd0fad41f5289e51efb342c1355551de782379ea.camel@mediatek.com>
Date:   Sat, 7 Oct 2023 07:45:45 +0000
From:   Mark-PK Tsai (蔡沛剛) 
        <Mark-PK.Tsai@...iatek.com>
To:     "senozhatsky@...omium.org" <senozhatsky@...omium.org>
CC:     "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "linux-mediatek@...ts.infradead.org" 
        <linux-mediatek@...ts.infradead.org>,
        "linux-mm@...ck.org" <linux-mm@...ck.org>,
        "akpm@...ux-foundation.org" <akpm@...ux-foundation.org>,
        "minchan@...nel.org" <minchan@...nel.org>,
        "linux-arm-kernel@...ts.infradead.org" 
        <linux-arm-kernel@...ts.infradead.org>,
        YJ Chiang (江英杰) <yj.chiang@...iatek.com>,
        "matthias.bgg@...il.com" <matthias.bgg@...il.com>,
        "angelogioacchino.delregno@...labora.com" 
        <angelogioacchino.delregno@...labora.com>
Subject: Re: [PATCH] zsmalloc: use copy_page for full page copy

On Fri, 2023-10-06 at 20:11 +0900, Sergey Senozhatsky wrote:
>  	 
> External email : Please do not click links or open attachments until
> you have verified the sender or the content.
>  
> On (23/10/06 14:02), Mark-PK Tsai wrote:
> > Some architectures have implemented optimized
> > copy_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.
> > 
> > Signed-off-by: Mark-PK Tsai <mark-pk.tsai@...iatek.com>
> 
> TIL
> 
> I've never heard of arm's copy_page() before. Is it really much
> faster than memcpy()?

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.

> 
> Reviewed-by: Sergey Senozhatsky <senozhatsky@...omium.org>
> 
> 
> > diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
> > index c743ce7a5f49..b1c0dad7f4cf 100644
> > --- a/mm/zsmalloc.c
> > +++ b/mm/zsmalloc.c
> > @@ -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().

Thank. I've just post another patch for zram_drv.c as below link.


https://lore.kernel.org/lkml/20231007070554.8657-1-mark-pk.tsai@mediatek.com/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ