From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752531AbbAaI77 (ORCPT ); Sat, 31 Jan 2015 03:59:59 -0500 Received: from mail-oi0-f51.google.com ([209.85.218.51]:40773 "EHLO mail-oi0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751419AbbAaI76 (ORCPT ); Sat, 31 Jan 2015 03:59:58 -0500 MIME-Version: 1.0 In-Reply-To: <1422107403-10071-1-git-send-email-opensource.ganesh@gmail.com> References: <1422107403-10071-1-git-send-email-opensource.ganesh@gmail.com> Date: Sat, 31 Jan 2015 16:59:58 +0800 Message-ID: Subject: Re: [PATCH] mm/zsmalloc: avoid unnecessary iteration when freeing size_class From: Ganesh Mahendran To: Minchan Kim , Nitin Gupta Cc: Andrew Morton , Linux-MM , linux-kernel , Ganesh Mahendran Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ping. 2015-01-24 21:50 GMT+08:00 Ganesh Mahendran : > The pool->size_class[i] is assigned with the i from (zs_size_classes - 1) to 0. > So if we failed in zs_create_pool(), we only need to iterate from (zs_size_classes - 1) > to i, instead of from 0 to (zs_size_classes - 1) No functionality has been changed. This patch just avoids some necessary iteration. Thanks. > > Signed-off-by: Ganesh Mahendran > Cc: Nitin Gupta > Cc: Minchan Kim > --- > mm/zsmalloc.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c > index 16617e9..e6fa3da 100644 > --- a/mm/zsmalloc.c > +++ b/mm/zsmalloc.c > @@ -1433,12 +1433,12 @@ void zs_destroy_pool(struct zs_pool *pool) > > zs_pool_stat_destroy(pool); > > - for (i = 0; i < zs_size_classes; i++) { > + for (i = zs_size_classes - 1; i >= 0; i--) { > int fg; > struct size_class *class = pool->size_class[i]; > > if (!class) > - continue; > + break; > > if (class->index != i) > continue; > -- > 1.7.9.5 >