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: 13025393 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 477E8FA3740 for ; Mon, 31 Oct 2022 05:41:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D8F798E0005; Mon, 31 Oct 2022 01:41:29 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D175E8E0001; Mon, 31 Oct 2022 01:41:29 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BE19C8E0005; Mon, 31 Oct 2022 01:41:29 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 99B618E0001 for ; Mon, 31 Oct 2022 01:41:29 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 3B31C8021F for ; Mon, 31 Oct 2022 05:41:29 +0000 (UTC) X-FDA: 80080147098.27.A251724 Received: from mail-pj1-f43.google.com (mail-pj1-f43.google.com [209.85.216.43]) by imf17.hostedemail.com (Postfix) with ESMTP id C859A40006 for ; Mon, 31 Oct 2022 05:41:28 +0000 (UTC) Received: by mail-pj1-f43.google.com with SMTP id f5-20020a17090a4a8500b002131bb59d61so11862023pjh.1 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=hVGKhmCQEuBx8E2QtlrKA/W8maYf0XEfPvaBf3yWaIzUilhhXNvhWMhyeuQnJ5bdgL NhUoRtdLWFkada92faORtNTn8ijo/7gWFNQ+pV2lveJN8RUBh/4VMS/JT5GamtOcg/IG Xu5MeDI6LYh0CkEOci0lF54NxtTxTpPWs1DbwVi6K2TCcrEWsnpEfY+wYYMrUFr6Fwp4 F6iomLNonWgQuWlcH0DdC0SbqjKgHfLDMpnmz8S5Z5o5OtMd6GG9cDHomVZ+CAhYHhxz qnWBhrXCJwq5EUdeZRK5gb+/mS8DD3mRjA4yZsdAiU81+yc4YMafGzFfD11EPeLEIquB 5V2A== X-Gm-Message-State: ACrzQf36dqhCcc0DlPNqmTr0WiHnDJOQzHlqkIXmA4Ms2mW2HSkriv52 HId6qLyEVsqT1Lx64bP8gCGnRg== X-Google-Smtp-Source: AMsMyM45I96pdiy6HLkp/Z+GW+ilK0vuA9XKCeCbpdBf2Nywu1yDwQlomYdS/WX51GnDSZg3i4eLcA== 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 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1667194888; a=rsa-sha256; cv=none; b=SeZCpY9PWAYvwzlgSPtcBBpmWO0AOp7XF+ifMpmGAo+SbnRsdjVo0ITtovc+DcfINCsS1y 8sqUKteZDof668jBQij5cHKreBRk7dz1/GHqeZAZnfbhHQN/jYbtnUisy4lB8e6hQcSEwr 1n63XW4+Cjo5/BXn5AOhbYQAiLXsc1g= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=hpb9n1tc; dmarc=pass (policy=none) header.from=chromium.org; spf=pass (imf17.hostedemail.com: domain of senozhatsky@chromium.org designates 209.85.216.43 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=1667194888; 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=xz2a6Gnxa0VzNk+aaf7V7ldsdawrXx9L2Y2yVCyV3wk=; b=mcGj0xk6OV6uurkYCaa1OZagEn/2h+vNwbOUep/fhExDFBBS8tZfib8TfVFGT6+ac/rA2L PQll+SwL1kYcCyF6hs6MfKnihCbci++dPBx5b+kRehphg2zrPmHJhsHoiS4dQ3ohe97zMi NS0Nn8MgQnyQXvt7tkPsvnV29kkw2Y8= X-Stat-Signature: 7b4ebgqabqwpnorynu7pxqryg6m1k943 X-Rspamd-Queue-Id: C859A40006 X-Rspam-User: Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=hpb9n1tc; dmarc=pass (policy=none) header.from=chromium.org; spf=pass (imf17.hostedemail.com: domain of senozhatsky@chromium.org designates 209.85.216.43 as permitted sender) smtp.mailfrom=senozhatsky@chromium.org X-Rspamd-Server: rspam09 X-HE-Tag: 1667194888-725375 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 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); } /*