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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160506043702.GB18573@bbox>
Date:	Fri, 6 May 2016 13:37:02 +0900
From:	Minchan Kim <minchan@...nel.org>
To:	Ganesh Mahendran <opensource.ganesh@...il.com>
Cc:	Sergey Senozhatsky <sergey.senozhatsky.work@...il.com>,
	Nitin Gupta <ngupta@...are.org>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Linux-MM <linux-mm@...ck.org>,
	linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] mm/zsmalloc: avoid unnecessary iteration in
 get_pages_per_zspage()

Hi Ganesh,

On Fri, May 06, 2016 at 12:25:18PM +0800, Ganesh Mahendran wrote:
> Hi, Minchan:
> 
> 2016-05-06 11:09 GMT+08:00 Minchan Kim <minchan@...nel.org>:
> > On Thu, May 05, 2016 at 07:03:29PM +0900, Sergey Senozhatsky wrote:
> >> On (05/05/16 13:17), Ganesh Mahendran wrote:
> >> > if we find a zspage with usage == 100%, there is no need to
> >> > try other zspages.
> >>
> >> Hello,
> >>
> >> well... we iterate there from 0 to 1<<2, which is not awfully
> >> a lot to break it in the middle, and we do this only when we
> >> initialize a new pool (for every size class).
> >>
> >> the check is
> >>  - true   15 times
> >>  - false  492 times
> >
> > Thanks for the data, Sergey!
> >
> >>
> >> so it _sort of_ feels like this new if-condition doesn't
> >> buy us a lot, and most of the time it just sits there with
> >> no particular gain. let's hear from Minchan.
> >>
> >
> > I agree with Sergey.
> > First of al, I appreciates your patch, Ganesh! But as Sergey pointed
> > out, I don't see why it improves current zsmalloc.
> 
> This patch does not obviously improve zsmalloc.
> It just reduces unnecessary code path.
> 
> From data provided by Sergey, 15 * (4 -  1) = 45 times loop will be avoided.
> So 45 times of below caculation will be reduced:
> ---
> zspage_size = i * PAGE_SIZE;
> waste = zspage_size % class_size;
> usedpc = (zspage_size - waste) * 100 / zspage_size;
> 
> if (usedpc > max_usedpc) {

As well, it bloats code side without much gain. I don't think
it's worth to do until someone really has trouble with slow
zs_create_pool performance.

add/remove: 0/0 grow/shrink: 1/0 up/down: 15/0 (15)
function                                     old     new   delta
zs_create_pool                               960     975     +15


> ---
> 
> Thanks.
> 
> > If you want to merge strongly, please convince me with more detail
> > reason.
> >
> > Thanks.
> >
> >
> >>       -ss
> >>
> >> > Signed-off-by: Ganesh Mahendran <opensource.ganesh@...il.com>
> >> > Cc: Minchan Kim <minchan@...nel.org>
> >> > Cc: Nitin Gupta <ngupta@...are.org>
> >> > Cc: Sergey Senozhatsky <sergey.senozhatsky.work@...il.com>
> >> > ---
> >> >  mm/zsmalloc.c |    3 +++
> >> >  1 file changed, 3 insertions(+)
> >> >
> >> > diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
> >> > index fda7177..310c7b0 100644
> >> > --- a/mm/zsmalloc.c
> >> > +++ b/mm/zsmalloc.c
> >> > @@ -765,6 +765,9 @@ static int get_pages_per_zspage(int class_size)
> >> >             if (usedpc > max_usedpc) {
> >> >                     max_usedpc = usedpc;
> >> >                     max_usedpc_order = i;
> >> > +
> >> > +                   if (max_usedpc == 100)
> >> > +                           break;
> >> >             }
> >> >     }
> >> >
> >> > --
> >> > 1.7.9.5
> >> >

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ