From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751281AbcEIFBO (ORCPT ); Mon, 9 May 2016 01:01:14 -0400 Received: from mail-pf0-f177.google.com ([209.85.192.177]:32860 "EHLO mail-pf0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751010AbcEIFBL (ORCPT ); Mon, 9 May 2016 01:01:11 -0400 From: Minchan Kim X-Google-Original-From: Minchan Kim Date: Mon, 9 May 2016 14:01:02 +0900 To: Sergey Senozhatsky Cc: Ganesh Mahendran , Minchan Kim , Nitin Gupta , Andrew Morton , Linux-MM , linux-kernel Subject: Re: [PATCH] mm/zsmalloc: avoid unnecessary iteration in get_pages_per_zspage() Message-ID: <20160509050102.GA4574@blaptop> References: <1462425447-13385-1-git-send-email-opensource.ganesh@gmail.com> <20160505100329.GA497@swordfish> <20160506030935.GA18573@bbox> <20160506090801.GA488@swordfish> <20160506093342.GB488@swordfish> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160506093342.GB488@swordfish> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 06, 2016 at 06:33:42PM +0900, Sergey Senozhatsky wrote: > On (05/06/16 18:08), Sergey Senozhatsky wrote: > [..] > > and it's not 45 iterations that we are getting rid of, but around 31: > > not every class reaches it's ideal 100% ratio on the first iteration. > > so, no, sorry, I don't think the patch really does what we want. > > > to be clear, what I meant was: > > 495 `cmp' + 15 `cmp je' IN > 31 `mov cltd idiv mov sub imul cltd idiv cmp' OUT > > IN > OUT. > > > CORRECTION here: > > > * by the way, we don't even need `cltd' in those calculations. the > > reason why gcc puts cltd is because ZS_MAX_PAGES_PER_ZSPAGE has the > > 'wrong' data type. the patch to correct it is below (not a formal > > patch). > > no, we need cltd there. but ZS_MAX_PAGES_PER_ZSPAGE also affects > ZS_MIN_ALLOC_SIZE, which is used in several places, like > get_size_class_index(). that's why ZS_MAX_PAGES_PER_ZSPAGE data > type change `improves' zs_malloc(). Why not if such simple improves zsmalloc? :) Please send a patch. Thanks a lot, Sergey!