From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752805AbcEEFYX (ORCPT ); Thu, 5 May 2016 01:24:23 -0400 Received: from mail.thundersoft.com ([114.242.213.34]:52179 "EHLO mail2.thundersoft.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750827AbcEEFYW (ORCPT ); Thu, 5 May 2016 01:24:22 -0400 X-Greylist: delayed 379 seconds by postgrey-1.27 at vger.kernel.org; Thu, 05 May 2016 01:24:22 EDT From: Ganesh Mahendran To: minchan@kernel.org, ngupta@vflare.org, sergey.senozhatsky.work@gmail.com, akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Ganesh Mahendran Subject: [PATCH] mm/zsmalloc: avoid unnecessary iteration in get_pages_per_zspage() Date: Thu, 5 May 2016 13:17:27 +0800 Message-Id: <1462425447-13385-1-git-send-email-opensource.ganesh@gmail.com> X-Mailer: git-send-email 1.7.9.5 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org if we find a zspage with usage == 100%, there is no need to try other zspages. 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