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: 13020478 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 A552CC38A2D for ; Wed, 26 Oct 2022 11:30:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2F61E8E0007; Wed, 26 Oct 2022 07:30:22 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 280928E0001; Wed, 26 Oct 2022 07:30:22 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 11F558E0007; Wed, 26 Oct 2022 07:30:22 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 0395F8E0001 for ; Wed, 26 Oct 2022 07:30:22 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id D121240F00 for ; Wed, 26 Oct 2022 11:30:21 +0000 (UTC) X-FDA: 80062882242.07.F5FAB5D Received: from mail-pj1-f48.google.com (mail-pj1-f48.google.com [209.85.216.48]) by imf15.hostedemail.com (Postfix) with ESMTP id 65991A0037 for ; Wed, 26 Oct 2022 11:30:21 +0000 (UTC) Received: by mail-pj1-f48.google.com with SMTP id b11so7603252pjp.2 for ; Wed, 26 Oct 2022 04:30:21 -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=SQc5LueE/GVoQCttC8pCqOLTraBjF7HAAuw0iJKPS5IBqG6+p1oKmh/FziZF9sTjxQ O3cbnNZ2SMGfQKwqg9T9cllO37COf+nLiQHCQ9V5/nqYfjDMq74GUMXKnz4lnpAKZzT3 yTRaaJ1IHZaB6U7VDvp6r9KbD1ah0cfZnShb/fa2zkC++Ljhy3JYj1C5uSkfn47HV9VM VKVpWJRRacMRgToozz4rryv7dgQ88fiGG4OtEyroHnETs4v0ixeeP81LFiG6QcFbj/5e NZ6K16qgosEm3znmXu1VT0lm6DmKzXTSX2KNtcnDrf6OWt/Znx1N+YlfXVW4X1PgdVUI vG4Q== X-Gm-Message-State: ACrzQf0KX3VqBcDIb00vS1PnPwgtLB0ZhWTBcZ1Ssv9bS2BHFaAuuRYt s9zv51Wx/GODU6Y1SsZPNgaX+Q== X-Google-Smtp-Source: AMsMyM5UbeAi24Gw3AydSIfj50cK8jTXEBcDGPH6Rbn9I/i+CUdqxadOzM4siEquUTc7gPP1/0zk8A== 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 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1666783821; 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=ZXAqqjDk6mAz2KU4pc8JUXu1b5D+3y6f+8lsfEOMErU=; b=mAFoFBLruFNzpOM30EbG4+Ft00bsyp6jd+MLWrfSHEaE7ZVX9xg7KNhnPYW/HKepLSO9hn sIbLnUDNBKE0CDoqlVvpMTwOC6O7Hlf/OJy8UaaxMoq5iwlW/x+MceSCE6v6oMUijDRkrL PxtejT74UMCaRFSPf4AF3Gs1jYwuMZM= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=mfSf8pCF; dmarc=pass (policy=none) header.from=chromium.org; spf=pass (imf15.hostedemail.com: domain of senozhatsky@chromium.org designates 209.85.216.48 as permitted sender) smtp.mailfrom=senozhatsky@chromium.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1666783821; a=rsa-sha256; cv=none; b=uPY6s4ZEW3foiwDAJGxuxoygLT+M9mYZGuRfFmMUa5I/TkNNhLKB2pAma5j9ObW9uqcrqj ajDIqF+d17xzEf4X6aVH2+x3WoWxiOiKjRmHxx2oFK0t7sWZ6XwlZWDu4NGiTXejlayjuB sFhGPR5MVm+MtgsTf9AqMcFspwGcg1o= X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 65991A0037 X-Rspam-User: Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=mfSf8pCF; dmarc=pass (policy=none) header.from=chromium.org; spf=pass (imf15.hostedemail.com: domain of senozhatsky@chromium.org designates 209.85.216.48 as permitted sender) smtp.mailfrom=senozhatsky@chromium.org X-Stat-Signature: zzr3q6s6sjij7nxg6wtfj39aurs3f14p X-HE-Tag: 1666783821-63466 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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); } /*