From patchwork Mon Oct 24 16:12:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Senozhatsky X-Patchwork-Id: 9906 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp578301wru; Mon, 24 Oct 2022 10:51:38 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7JDGuoxN1cp3As04Npni8xTYiI6sQ40p8n67otx7ScH583TId6fyU39glfU5QdV8oZfBXW X-Received: by 2002:a17:902:d70e:b0:178:2d9d:ba7b with SMTP id w14-20020a170902d70e00b001782d9dba7bmr34926401ply.90.1666633898665; Mon, 24 Oct 2022 10:51:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666633898; cv=none; d=google.com; s=arc-20160816; b=B3rK9VRqlzO8Gxx6vO/viS6ZKa9D22PWJ1reHndmE4Aog3QVPhU8XA95RCRjq+rDEk uOviAYTDbTqWIe3rI21+T84wlmsNr205hboyGpRZoYCtOF/cv3vMWQNuogRNWtzdHVdt wwYma7rRl9/hGAcKwvN/Uh7SzkjNklsiUyiLffU7emREWQLDKqgnKE1r2Kehq0u/i5Bi 1QnY1dooxgTBR1bCTydljlGd5b5h9J0iIQGKFKwdlLMkw356ALpjJP4ZOJyqKZ2MgRXs yKlHNaXKvGmQkHp0wug0qBULbRH4MWq0lD7HwNMLkaM6gXJHiEhcJwbD22voblzg/3Bf NAsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=NPUA49DxSROeuVXUf5+5dYRiCRYwBmJzY7QehiBfLmI=; b=i9MNCRcbzgqWF8E7uTOIlL54fzMVXTG/3dS+rprGK+oDdXid7Sv0l6ZScI9qnFrB2N i/0Jwt0ejRROMdssJmQyfr5RhNoKJuDDzEWnu8aISdmNGVl+dmjxq8xGKOic0xkeBIol Yq1VCkONb9dOQsrZ+6MkVQtKsM/jR1NXeksGMR/PVn4cnUxiDqVpMOhIAayqzafO2j7H mHKhMSfk9pas8zbndtne0ouxEK2BUv1WS3cFWtB5I6EtM9DEgwhzNxHEd4K2SUNavlcg ir3hpLUSr+dD9F5onHHRjIzHEDmKltCLqjkMJGK9Ufjrh6IIkOPn13qC+UDR/1i7CdyI FFew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="EV/G2vlr"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t14-20020a635f0e000000b004344b581925si47391pgb.879.2022.10.24.10.51.24; Mon, 24 Oct 2022 10:51:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="EV/G2vlr"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231290AbiJXRsq (ORCPT + 99 others); Mon, 24 Oct 2022 13:48:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57610 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232560AbiJXRs2 (ORCPT ); Mon, 24 Oct 2022 13:48:28 -0400 Received: from mail-pg1-f172.google.com (mail-pg1-f172.google.com [209.85.215.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 22F8FBEAFF for ; Mon, 24 Oct 2022 09:25:10 -0700 (PDT) Received: by mail-pg1-f172.google.com with SMTP id 78so9047785pgb.13 for ; Mon, 24 Oct 2022 09:25:09 -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=NPUA49DxSROeuVXUf5+5dYRiCRYwBmJzY7QehiBfLmI=; b=EV/G2vlr9ho5Ulkc8sroUJ+aLbRJoO3MY36vm4QL6xhuYyNjpL7Ar87vrlrAZ5Svm8 rbhIxyNU/WCYSM4dKZqJeI1a0HC2RhQzSx8q4R8RoowxZFSpPbFNOdbB5yGxYkkko3BM jE8lRkc7rPtLERNeVljXsu9Q7FuZGB/Z+DT7o= 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=NPUA49DxSROeuVXUf5+5dYRiCRYwBmJzY7QehiBfLmI=; b=iGx6WnWYTmJljeqBa7FtZhIdSKl3+4KYJwgxEo9LBJBaAvtwSKpktkK6d67XRIXOOG XkxFJEsbbZOG/Nu2CQgHwauoCrKvNfPDWi3L9M4/Cf08VjKQHSHwFgvolY+sJ14QxmqS vmSmSc4kQLCnj3hlCgHKuy4N2fBoSO14ZuiVS25VbNuhjavVt9OSMIUgOBXpz64fGRkv KRmjTeD7nKr8An560JQWmDTjwpc7fqq5N/6ufm/PYsQ4ZICNW6dr/fDJJf1VPu/NaJul mH78Qan2enI/diQlJ77pqIP1PHFatjherp2BnL7oQF70lZooLFbjxRVOBLCPcEU+06xU 65iA== X-Gm-Message-State: ACrzQf1VQwf5+mgqxcpB/El5NJdlIyWl+qGk6IYOyFmZqDLOhsXMt4TC tW/PI7EwjTuZCvUXDp8c90vP+K5VbnuqJg== X-Received: by 2002:a63:7304:0:b0:46a:faa5:700f with SMTP id o4-20020a637304000000b0046afaa5700fmr29794719pgc.253.1666627958807; Mon, 24 Oct 2022 09:12:38 -0700 (PDT) Received: from tigerii.tok.corp.google.com ([2401:fa00:8f:203:5f9c:c5bc:902f:3da4]) by smtp.gmail.com with ESMTPSA id u70-20020a627949000000b0056b8726d2d3sm5162pfc.157.2022.10.24.09.12.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Oct 2022 09:12:38 -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: [PATCH 5/6] zsmalloc: break out of loop when found perfect zspage order Date: Tue, 25 Oct 2022 01:12:12 +0900 Message-Id: <20221024161213.3221725-6-senozhatsky@chromium.org> X-Mailer: git-send-email 2.38.0.135.g90850a2211-goog In-Reply-To: <20221024161213.3221725-1-senozhatsky@chromium.org> References: <20221024161213.3221725-1-senozhatsky@chromium.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747592306844496659?= X-GMAIL-MSGID: =?utf-8?q?1747592306844496659?= 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 fa55e0c66f8d..40a09b1f63b5 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -790,6 +790,9 @@ static int get_pages_per_zspage(struct zs_pool *pool, int class_size) max_usedpc = usedpc; max_usedpc_order = i; } + + if (usedpc == 100) + break; } return max_usedpc_order;