From patchwork Thu Oct 27 04:26:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Senozhatsky X-Patchwork-Id: 13021580 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7DF18C38A2D for ; Thu, 27 Oct 2022 04:27:20 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 132788E000C; Thu, 27 Oct 2022 00:27:20 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0E3548E0001; Thu, 27 Oct 2022 00:27:20 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F147E8E000C; Thu, 27 Oct 2022 00:27:19 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id E257F8E0001 for ; Thu, 27 Oct 2022 00:27:19 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id C1098120CC4 for ; Thu, 27 Oct 2022 04:27:19 +0000 (UTC) X-FDA: 80065444998.04.82C923E Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) by imf03.hostedemail.com (Postfix) with ESMTP id 6E90920008 for ; Thu, 27 Oct 2022 04:27:19 +0000 (UTC) Received: by mail-pl1-f169.google.com with SMTP id c2so207407plz.11 for ; Wed, 26 Oct 2022 21:27:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=7FNBg/Bhf+QH0mnqszhtlK9l4+LQ4+hxFffFVTQHkLU=; b=VTCt4sWyUlHu3XwJaayi2bF65TY7ie/rwhOYEU+57lhIbz1GKvZDHXuccXF5EjAfuh 7FEovYIidq2NDbGQrRakQxt/e+Tutl18/H0f3yoDqHk33zKQwnxEA5P5ubClFTnmp49x vtWfyu4sNUmcuiCa3BE8lSE4BNmsluANiBs5g= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7FNBg/Bhf+QH0mnqszhtlK9l4+LQ4+hxFffFVTQHkLU=; b=IKu7cCpTcjGqabUFnJLgw61K3n5w1hblPbCpvo0Qkl1FfA68mf7//vTei7tWq5Gxj+ /U/qte6QYQ+59Ts7i3VqQJXhkNnvidgE/1Zbairln7aKLbx5AIgjVQ3E6oj0wG7wN/bG wvARKFrTch7aQhV8Gh06/z3Z54EMdZuCbthVTP1Q0abeqLJ3R5sgeIxxcB92gsb0IV0B H8aFccVPJLdJ3YLuJr6LTFnp44XTVQTO8Y21yyzT1SyHqWVuuoyM1uFFAL6p+rrAYV2J pA/HuVnuyQ4xBie+lEY6zWMeMum9ExrlUSEwmSFkeJqtD7Xedzibd1OmaK2JWcEfVF3g mDfQ== X-Gm-Message-State: ACrzQf0q59ylVKs3l/Fcl+k3Qh6XNCZ3+a7p11eQPCvozB9B3Xky4Y7z g5t2uwNxqfVWhgF24xMeHqeKAw== X-Google-Smtp-Source: AMsMyM6mLY1dGQXaB9/3tNuXFNI8esnOKI319xKEiHu48v+dy2FaSTPUqy9QaGZSM24wlt0gt5x2eA== X-Received: by 2002:a17:90a:1b44:b0:213:1035:f913 with SMTP id q62-20020a17090a1b4400b002131035f913mr7776402pjq.133.1666844838446; Wed, 26 Oct 2022 21:27:18 -0700 (PDT) Received: from tigerii.tok.corp.google.com ([2401:fa00:8f:203:30f2:4501:65fa:df12]) by smtp.gmail.com with ESMTPSA id w23-20020aa79557000000b00565c8634e55sm203140pfq.135.2022.10.26.21.27.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Oct 2022 21:27:18 -0700 (PDT) From: Sergey Senozhatsky To: Andrew Morton , Minchan Kim Cc: Nitin Gupta , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Sergey Senozhatsky Subject: [PATCHv3 9/9] zsmalloc: break out of loop when found perfect zspage order Date: Thu, 27 Oct 2022 13:26:51 +0900 Message-Id: <20221027042651.234524-10-senozhatsky@chromium.org> X-Mailer: git-send-email 2.38.0.135.g90850a2211-goog In-Reply-To: <20221027042651.234524-1-senozhatsky@chromium.org> References: <20221027042651.234524-1-senozhatsky@chromium.org> MIME-Version: 1.0 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1666844839; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=7FNBg/Bhf+QH0mnqszhtlK9l4+LQ4+hxFffFVTQHkLU=; b=qIdr+r48oBy7tQUQhvUYhqp1XVqU1HEW7AaRAWfIKXISbOguJv59jSNIQjGTm4U6rAoFli WUvz59EeqGEtLMnbik0hGgjD3ylTzaSVk6yODuZZ32TBOA3euD8sPCILAPLb6dqoW3apf6 dCVYS/IY7QO+E3PKrpekxXdpZxsr0QQ= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=VTCt4sWy; dmarc=pass (policy=none) header.from=chromium.org; spf=pass (imf03.hostedemail.com: domain of senozhatsky@chromium.org designates 209.85.214.169 as permitted sender) smtp.mailfrom=senozhatsky@chromium.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1666844839; a=rsa-sha256; cv=none; b=UMh7+HxAxyAlkHYXJ1Vw5De9gZ2zYpDNBUM1v0t6ZECS5LV6fNr4pLRj/efnG4ObS4UxV6 w7gS4z4eu5QvgxarIhlioNJ5YLyrjHiZyzNCl1wXfU7epGMM2daY53bhM7IC2ttgD6FoX9 Q4sHlTfldJgo27IrGi/GtMkoHF/KhTY= X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 6E90920008 X-Rspam-User: Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=VTCt4sWy; dmarc=pass (policy=none) header.from=chromium.org; spf=pass (imf03.hostedemail.com: domain of senozhatsky@chromium.org designates 209.85.214.169 as permitted sender) smtp.mailfrom=senozhatsky@chromium.org X-Stat-Signature: 87szo1i55phir9sp7h1ieej5e6t8ncra X-HE-Tag: 1666844839-180612 X-Bogosity: Ham, tests=bogofilter, spamicity=0.001608, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: If we found zspage configuration that gives us perfect 100% used percentage (zero wasted space) then there is no point it trying any other configuration Signed-off-by: Sergey Senozhatsky --- mm/zsmalloc.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c index 7465a45495bf..0bc9ed1f1a5d 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -787,6 +787,9 @@ static int get_pages_per_zspage(u32 class_size, u32 max_pages_per_zspage) max_usedpc = usedpc; max_usedpc_order = i; } + + if (usedpc == 100) + break; } return max_usedpc_order;