From patchwork Wed Oct 26 11:29:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Senozhatsky X-Patchwork-Id: 11201 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp205834wru; Wed, 26 Oct 2022 04:32:21 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5vquN97bWPj5Cg9gPIyVjvc59pGknNsmgDx8LzQlb1j/e7A/fnx/8yGmGsZvajlLD95PKX X-Received: by 2002:a05:6402:4150:b0:44a:ec16:def4 with SMTP id x16-20020a056402415000b0044aec16def4mr40996147eda.21.1666783941394; Wed, 26 Oct 2022 04:32:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666783941; cv=none; d=google.com; s=arc-20160816; b=Bxzyx6cauVh5LZ29TIiFn9qEL+KtydcNtOr0Pf2zceuY4WJR6UwxFzaiHUI4iNEnDl nD/A71unnP+4NpT0Pt5cxlzPfOuwe19XLhypvAFRLgrksZyFgS6I+x/EPwmcNdrfTKrn MQ8XMUw9qnPRj9Nvxy38hHQZFc5RoFHyIcYB7IxRbT7/aEhh07/6n/vLLWMYRHk4cxJS 4LLrKDQfPY6C6YrAAtkthxXoWUQ5Uzm75C0x+XLVS4n2Lw7u2KFaOZxmTZOcYHsKPU6Q sGvn+5dzTZudPpisFTVClvoTj9K3phCCvd6CN6cnbs0mWgXseaQEVXOMhyuTGNSBt3iW XlAQ== 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=ZXAqqjDk6mAz2KU4pc8JUXu1b5D+3y6f+8lsfEOMErU=; b=MA2unmtpKU/0SwIFMrN7/pNgpLj7ZonLDUl2dVhGdGFITAcY+6CSChLzrIKAnzGsA4 vCYSyL1df7iMaIBS7duvsc+Xw9DK/OQBuOZdWJOobyZcyjiVeDVCMVsKdnPm/MVkE+hR CNAxYdmYAmLk/L42+AtUQDmObp/+Fh5gWFq5wFz+9HiIqPJuNPo8AQ4g36NwinwKDpqX Eqwi+yRdE6oJf3Y2SMJ60eJwp1KCshI5LOtlroTh80P857NawYXFCox37Mxh89cwktfk DRdnRQxZah2wTeXLeImQj5Zq8k6PDv79iQIPR0tHXfo1Uw1+16OcGmmfeylooQTYbZCE ogqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=mfSf8pCF; 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 x4-20020a1709060a4400b0078dcbd7d244si4647860ejf.376.2022.10.26.04.31.57; Wed, 26 Oct 2022 04:32:21 -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=mfSf8pCF; 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 S233397AbiJZLam (ORCPT + 99 others); Wed, 26 Oct 2022 07:30:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58742 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233056AbiJZLa2 (ORCPT ); Wed, 26 Oct 2022 07:30:28 -0400 Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD80B326DC for ; Wed, 26 Oct 2022 04:30:20 -0700 (PDT) Received: by mail-pj1-x1031.google.com with SMTP id pb15so13698736pjb.5 for ; Wed, 26 Oct 2022 04:30:20 -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=ZXAqqjDk6mAz2KU4pc8JUXu1b5D+3y6f+8lsfEOMErU=; b=mfSf8pCFQJ6HG+oVrglzfNEsFiRm6IBwVmjr6QDF19ZwVOdp+OymSnDyDHkDq4CyU2 YP6CIIpTxjmt05dh9LZr+TJPmMS1e+zdccy2qcES0hkNMO0h27Ltk6PSb9L34EDqitgZ MS/sDaeSUqvJNQXPgdb8NLAlxORIG+41vriG0= 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=ZXAqqjDk6mAz2KU4pc8JUXu1b5D+3y6f+8lsfEOMErU=; b=SGqPDjZMh7XbH7ONOyTw3lwo0d897znwsiBfY8e8H7YIoIXn0yBblGnuuh1m1RpyTv 8sTtQrImWeEE+Y7i/wdpj2+tZd4HtiLcYpXUA5Y831FiNXb5kSdRfEWOVwhyMi4y2iyw xur8eG9bvParlbSJWhn8jxBFS7hXnSBC2mMFfGLWgIOlNnUQldjX4wbq8BDfd9UIavBG uzsz9gc8t9nzWxFo/w4TW2zzOo/SsWSmt6YY8z/KwpzxVewEY7NZWyGU+Cie6ioeT/Ep hTrwjwBXPUc3n1B1bbGjKNq+0P2pCEmJKmLJFx3JoXwKIEWJZfqp7QZdSoBGD4NZhhmr vcqg== X-Gm-Message-State: ACrzQf0SsBbDLqNiFhp/bu3oDJiKfdzq38f99y3S1yMtDCR8fUU0VKPL U1vlTriugbIxMUHG8/iTYYnLsA== X-Received: by 2002:a17:902:f60c:b0:17c:163f:c0a8 with SMTP id n12-20020a170902f60c00b0017c163fc0a8mr42230267plg.38.1666783820285; Wed, 26 Oct 2022 04:30:20 -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.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Oct 2022 04:30:19 -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 4/9] zsmalloc: make huge class watermark zs_pool member Date: Wed, 26 Oct 2022 20:29:28 +0900 Message-Id: <20221026112933.4122957-5-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 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, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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?1747749638057492838?= X-GMAIL-MSGID: =?utf-8?q?1747749638057492838?= We will permit per-pool configuration of pages per-zspage value, which changes characteristics of the classes and moves around huge class size watermark. Thus huge class size needs to be a per-pool variable. Signed-off-by: Sergey Senozhatsky --- mm/zsmalloc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c index d4f68fba746b..cab8080e2fc6 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -178,7 +178,6 @@ static struct dentry *zs_stat_root; * (see: fix_fullness_group()) */ static const int fullness_threshold_frac = 4; -static size_t huge_class_size; struct size_class { spinlock_t lock; @@ -227,6 +226,7 @@ struct zs_pool { u32 num_size_classes; u32 min_alloc_size; + size_t huge_class_size; struct zs_pool_stats stats; @@ -1350,7 +1350,7 @@ EXPORT_SYMBOL_GPL(zs_unmap_object); */ size_t zs_huge_class_size(struct zs_pool *pool) { - return huge_class_size; + return pool->huge_class_size; } EXPORT_SYMBOL_GPL(zs_huge_class_size); @@ -2264,8 +2264,8 @@ struct zs_pool *zs_create_pool(const char *name) * endup in the huge class. */ if (pages_per_zspage != 1 && objs_per_zspage != 1 && - !huge_class_size) { - huge_class_size = size; + !pool->huge_class_size) { + pool->huge_class_size = size; /* * The object uses ZS_HANDLE_SIZE bytes to store the * handle. We need to subtract it, because zs_malloc() @@ -2275,7 +2275,7 @@ struct zs_pool *zs_create_pool(const char *name) * class because it grows by ZS_HANDLE_SIZE extra bytes * right before class lookup. */ - huge_class_size -= (ZS_HANDLE_SIZE - 1); + pool->huge_class_size -= (ZS_HANDLE_SIZE - 1); } /*