From patchwork Wed Oct 26 11:29:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Senozhatsky X-Patchwork-Id: 13020483 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 005FEC433FE for ; Wed, 26 Oct 2022 11:30:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9848E8E000C; Wed, 26 Oct 2022 07:30:34 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 934ED8E0001; Wed, 26 Oct 2022 07:30:34 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7AF158E000C; Wed, 26 Oct 2022 07:30:34 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 6D1448E0001 for ; Wed, 26 Oct 2022 07:30:34 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 5201340CCA for ; Wed, 26 Oct 2022 11:30:34 +0000 (UTC) X-FDA: 80062882788.29.7E2A026 Received: from mail-pj1-f41.google.com (mail-pj1-f41.google.com [209.85.216.41]) by imf26.hostedemail.com (Postfix) with ESMTP id 0657C140002 for ; Wed, 26 Oct 2022 11:30:33 +0000 (UTC) Received: by mail-pj1-f41.google.com with SMTP id r61-20020a17090a43c300b00212f4e9cccdso2107617pjg.5 for ; Wed, 26 Oct 2022 04:30:33 -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=G7cnezaP4xPJIUUd/O3Oge2fK4g5d2+XQaCibffMFdi3ViJL2Y/s4f/nt9Hi4MDfPA pkE8Fdr1ScJKMJtAGzAm5Zx0PolERV0WGyH0N0ZVXkHRf0QVan3J7XhuR/878qNg1c3w 4chxtFk7f9fmJpYo6ZXU3un+1cKdxt4nyor0w= 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=bwLQVXOyWEt5KM0iLtRT/YhBv08f7XIYAcWymvcUBMRZG500vVDZRSx/5a2Gpj8jMx G1cA628i98qzlY90XXeJOcOP49SBHbwpTC1N6q6cRFuGcMys50QSV6uhxgiRhrnfRyxc 2caN3ijY69SpKOosr6yHh0A4T8wZPFG5lJHQ2n4yTh5wgnkJQTQmV0eJeFKlsKtbVarN s1LiUZ/cNhlw/O8pGydd5dbWOJg3CscKp5iwCImbGSpAYubiL48seetbwOf4mApnW0/K Jbt8uVYyOj48XIMqPQjhzt8gnm+mGo/gQmwEe0P4Li4x2T2laDnNRSfx+Jz/hrYIpFHX 6iFw== X-Gm-Message-State: ACrzQf2nL+FIwwllXadFHqBXJt6s8B10GdqrKCbldI4RSdMivGsPd2Nr 9jpMOAxuOYSoRZpLd1VNAxJZ0g== X-Google-Smtp-Source: AMsMyM5+2bxdyjFQ1ABaYGtesEDrenS0XByOAFjq+hrScq9SvP3QJs84qZgmiyZgCQXJCKYavG1+qg== X-Received: by 2002:a17:90b:4d08:b0:20a:6861:352c with SMTP id mw8-20020a17090b4d0800b0020a6861352cmr3698168pjb.225.1666783833085; Wed, 26 Oct 2022 04:30:33 -0700 (PDT) Received: from tigerii.tok.corp.google.com ([2401:fa00:8f:203:749c:f7f5:1a8e:d0be]) by smtp.gmail.com with ESMTPSA id x127-20020a626385000000b005627868e27esm2814919pfb.127.2022.10.26.04.30.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Oct 2022 04:30:32 -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: [PATCHv2 9/9] zsmalloc: break out of loop when found perfect zspage order Date: Wed, 26 Oct 2022 20:29:33 +0900 Message-Id: <20221026112933.4122957-10-senozhatsky@chromium.org> X-Mailer: git-send-email 2.38.0.135.g90850a2211-goog In-Reply-To: <20221026112933.4122957-1-senozhatsky@chromium.org> References: <20221026112933.4122957-1-senozhatsky@chromium.org> MIME-Version: 1.0 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1666783834; a=rsa-sha256; cv=none; b=isGwCPNlqqbLSyLnT4/fqaLoJgpy6EKjbODxsDPXHCQikODTqm6+VgFmeate0CqR6UU39w GOAoqHL8D1joc9Zhh6gvo7hN8i5DF8uvqvlC6GLHiny2VGREUsrJKPqUFcnj/J6KGsV/s+ 9hApRgceiGIHqaVOuvVKHyqG4iXkvTM= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=G7cnezaP; dmarc=pass (policy=none) header.from=chromium.org; spf=pass (imf26.hostedemail.com: domain of senozhatsky@chromium.org designates 209.85.216.41 as permitted sender) smtp.mailfrom=senozhatsky@chromium.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1666783834; 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=qIl1TVdPFYsj+lLPZ0VT/JSZKL6cfr7HJbcmfPnl4CTTQidQmuyHJbRDOckI6HOyBfOWeI qe+2iio8BucLkdS1YWdAfnQ+ayWOYsjwS3xi3+2cHNYoZvWNGtLpsoydU1kE9OMmABqPs5 1IjnY8JPloW8PrPDT93BxXZAS8olvoQ= X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 0657C140002 X-Rspam-User: Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=G7cnezaP; dmarc=pass (policy=none) header.from=chromium.org; spf=pass (imf26.hostedemail.com: domain of senozhatsky@chromium.org designates 209.85.216.41 as permitted sender) smtp.mailfrom=senozhatsky@chromium.org X-Stat-Signature: w54sdyxsozap3dzof5zdm9woj8338id9 X-HE-Tag: 1666783833-922368 X-Bogosity: Ham, tests=bogofilter, spamicity=0.001533, 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;