From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757359AbcEFDJa (ORCPT ); Thu, 5 May 2016 23:09:30 -0400 Received: from LGEAMRELO11.lge.com ([156.147.23.51]:58844 "EHLO lgeamrelo11.lge.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755970AbcEFDJ3 (ORCPT ); Thu, 5 May 2016 23:09:29 -0400 X-Original-SENDERIP: 156.147.1.125 X-Original-MAILFROM: minchan@kernel.org X-Original-SENDERIP: 10.177.223.161 X-Original-MAILFROM: minchan@kernel.org Date: Fri, 6 May 2016 12:09:35 +0900 From: Minchan Kim To: Sergey Senozhatsky Cc: Ganesh Mahendran , ngupta@vflare.org, akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm/zsmalloc: avoid unnecessary iteration in get_pages_per_zspage() Message-ID: <20160506030935.GA18573@bbox> References: <1462425447-13385-1-git-send-email-opensource.ganesh@gmail.com> <20160505100329.GA497@swordfish> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160505100329.GA497@swordfish> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.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. If you want to merge strongly, please convince me with more detail reason. Thanks. > -ss > > > Signed-off-by: Ganesh Mahendran > > Cc: Minchan Kim > > Cc: Nitin Gupta > > Cc: Sergey Senozhatsky > > --- > > 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 > >