From patchwork Mon Oct 31 05:41:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Senozhatsky X-Patchwork-Id: 13116 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2127898wru; Sun, 30 Oct 2022 22:42:32 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5qzsn8eS9rSu0tFzMMbHNsblFi3gxOh2gqKd6YfabGXoeQvhFEO7FR8aHW8hACtsm9Gq2m X-Received: by 2002:a17:902:d486:b0:186:cf83:4ba8 with SMTP id c6-20020a170902d48600b00186cf834ba8mr12761900plg.154.1667194952033; Sun, 30 Oct 2022 22:42:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667194952; cv=none; d=google.com; s=arc-20160816; b=QKllFiQpiX8UHrIzLXpIgDJto7FbMVfbBdcxXPiuH/pfswkfF9WXPa7JMS7HzBMH2x iZnIOHcFxXl1IER+a87MSelBUm+FUB00saWlZSOS9NO2c1bMevSPiSk6C9qfUcoBVD7F 2nABrC4a5/ANxXxoS9X28axvhkw3D47b8VFsATXJHhbwd2GBBtMWWhx+VdCWTw3/qN1C 2KVyPUD/8Et3ucO1n5tghfgW2Rnvfm/NFjkuQLx3u6klKysXwvvIsemDQWAtU9FICVLX eFoaezFvVW4Jh57fsS6av/N3603MAMysiBTgaJcTmHZZhcTOTLG/uifHPZtYZTFwlUis E2hA== 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=xz2a6Gnxa0VzNk+aaf7V7ldsdawrXx9L2Y2yVCyV3wk=; b=ffcgT0RGQFmYkErQMf/ZpYgzU3/vdcyRtoSLN/5Xe89XIgMyg3KUGSdd+NSj15O6dO I/JAPzwxNtQjQKLHaQY2lh6hB9sekNZOn2ISXwsvKyFEG2Y2F9YzbPJRcI9DDtmgJiot JGKh0SZo6lea1aYET0f/6vId91sKBVMJbAYb3a5gC39ipaAb8vdqrmW0x84EtrER7G3a 2EaNoh7h8860CX1uQQ00z4vkRHq3YmMoEIhfnLrXdDiQbhxgCbR++i6mKF7hASzu5hfm GK2Uxs888fLNo4QPRkNLLFFBQtc7gah8kOuAv3Ws5fJiNvdL0EnBH5smlIB8Iy3epq0H EoxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=hpb9n1tc; 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 g10-20020a170902934a00b00186ada43088si6324010plp.517.2022.10.30.22.42.19; Sun, 30 Oct 2022 22:42:32 -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=hpb9n1tc; 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 S229853AbiJaFlw (ORCPT + 99 others); Mon, 31 Oct 2022 01:41:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229842AbiJaFll (ORCPT ); Mon, 31 Oct 2022 01:41:41 -0400 Received: from mail-pl1-x62a.google.com (mail-pl1-x62a.google.com [IPv6:2607:f8b0:4864:20::62a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F8E4AE6F for ; Sun, 30 Oct 2022 22:41:28 -0700 (PDT) Received: by mail-pl1-x62a.google.com with SMTP id p3so9828968pld.10 for ; Sun, 30 Oct 2022 22:41:28 -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=xz2a6Gnxa0VzNk+aaf7V7ldsdawrXx9L2Y2yVCyV3wk=; b=hpb9n1tc4pH+/W4WEarHdEJTdKB8Ai2ziveapp1wFdmhGqQdaw2eIO47MVgU9X5z/x ksPR6wC6yaqkhc/7Gjw5j1+OxfdJ2fX7sdKnVGFSvnb2tH2Ewj3HO0DYDPUMqb3x5NBE XbPIXzjLvbXmstz37m4M+DFTtqlVUc/uSW7QM= 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=xz2a6Gnxa0VzNk+aaf7V7ldsdawrXx9L2Y2yVCyV3wk=; b=ja5oo2UU877c+SUUtahOvfrx8R5J0jyrCBytNFpE4xTpM4QZo7I8mGvtOq0eDVAyY2 LcxOHuNNxwQl0WH2nmFMiS/12XlwIbKumZHYeyXlf5efiCX9WoB1PufGRDHqniBaQa6N qal9y/y4UleI8mhWQwnR+s0deZfmaNTj3vwVhsuARlnu+D+YMlCEDJUMF/qqTB1h4UdU 6JJAoHnJQ5tUDqOhWYljHZhidhXvMdKo0eD7y04OozJwFuWDKcpt+1oatpxfnlVCxku/ 5ZOcU2gPLKkldD0leN8rRWpWq7SbJbabX3iueOKtMW28rOua1J8atqonk/gyCKd3MiEu mMzg== X-Gm-Message-State: ACrzQf3mX4jcQ5uHaKsI+Wy0lj0ftldWAfvjuv5SpbpwCR8aXaNCSRUd j/EF5w3w/xBbUvHvNLygvk8K2XO7l/zTKQ== X-Received: by 2002:a17:903:1211:b0:178:9353:9e42 with SMTP id l17-20020a170903121100b0017893539e42mr12657945plh.45.1667194887696; Sun, 30 Oct 2022 22:41:27 -0700 (PDT) Received: from tigerii.tok.corp.google.com ([2401:fa00:8f:203:7616:afe0:ba6c:96f4]) by smtp.gmail.com with ESMTPSA id w12-20020aa79a0c000000b0056befcd7958sm3573308pfj.84.2022.10.30.22.41.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 30 Oct 2022 22:41:27 -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: [PATCHv4 4/9] zsmalloc: make huge class watermark zs_pool member Date: Mon, 31 Oct 2022 14:41:03 +0900 Message-Id: <20221031054108.541190-5-senozhatsky@chromium.org> X-Mailer: git-send-email 2.38.1.273.g43a17bfeac-goog In-Reply-To: <20221031054108.541190-1-senozhatsky@chromium.org> References: <20221031054108.541190-1-senozhatsky@chromium.org> MIME-Version: 1.0 X-Spam-Status: No, score=-3.2 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 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?1748180613921003311?= X-GMAIL-MSGID: =?utf-8?q?1748180613921003311?= 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 5f79223e7bfe..d329bd673baa 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); @@ -2262,8 +2262,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() @@ -2273,7 +2273,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); } /*