From patchwork Mon Oct 24 16:12:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Senozhatsky X-Patchwork-Id: 13017765 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 2B10CECAAA1 for ; Mon, 24 Oct 2022 16:12:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 512A7940009; Mon, 24 Oct 2022 12:12:27 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4C2D5940007; Mon, 24 Oct 2022 12:12:27 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 38AD5940009; Mon, 24 Oct 2022 12:12:27 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 253A2940007 for ; Mon, 24 Oct 2022 12:12:27 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id B5E1E120C4C for ; Mon, 24 Oct 2022 16:12:26 +0000 (UTC) X-FDA: 80056335492.29.47457B6 Received: from mail-pf1-f170.google.com (mail-pf1-f170.google.com [209.85.210.170]) by imf16.hostedemail.com (Postfix) with ESMTP id 4341818003E for ; Mon, 24 Oct 2022 16:12:26 +0000 (UTC) Received: by mail-pf1-f170.google.com with SMTP id d10so9357686pfh.6 for ; Mon, 24 Oct 2022 09:12:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=Dt6vGfaF+WpKB2crlph/A5DawhX6V7zOYBBnigw00K8=; b=gxgpngwcw2J9m/Txxh6Na8bPvzW7DpRvyLskV2o/EH1wrJNYuvEMYkLBLmTe/LrASH d5SdSjRqQxkxBFw6XtHwntsTV6ca36egfkxCcM1vSnj+Y2sei90tvUKDg4SUllnl6rrG CrdBrnL+bQs6ofFUy8OGAj9g+J+oh4ihqqviA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Dt6vGfaF+WpKB2crlph/A5DawhX6V7zOYBBnigw00K8=; b=BY7KtPobsoYwYJooIollPfntAu4Gq/FV+LpHRY7vuhsLGtHbh899bDXNLYj82hoMhO Cpt3kjIGOR9gpX+lVJWLq9y08xil/PMjmS6b2Re3TS36qxAHj7LN4Zzo/n1ecAXezXJm +2TCjZUU8bxldKNZLlq30jhptk9TSyZx2HBzUjbwJANN5HpOXpNAxjnS6YGRNnTGNOMm p+3dIVVpt5iwesEpjJUMuYkylGg/lEe9gdS4YUQPPOzHNrQqYxuehcGbrKk1CZ24hf5O GDkkR6iclLcd3X/d0ytfMfBdOwzOIgMR0+krE8mjYNs78p9K7coj61byg7v6oT7YHach k7ow== X-Gm-Message-State: ACrzQf1oi0NQhQgRPcNom3FZgaLqH8Pza1lhBCcMePdRM9Z3QLEF16lV POodg7v1xSrs5wDVV+JHBPLwEw== X-Google-Smtp-Source: AMsMyM7wdlTIAwvAIWczUmdLq1L6gOiBklArWhdVKCfK9pv9FH95uWIICSC3F8VwFcAIA4lNNeesOQ== X-Received: by 2002:a63:e40e:0:b0:46e:acf4:628c with SMTP id a14-20020a63e40e000000b0046eacf4628cmr18342548pgi.159.1666627945079; Mon, 24 Oct 2022 09:12:25 -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.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Oct 2022 09:12:24 -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 0/6] zsmalloc/zram: configurable zspage size Date: Tue, 25 Oct 2022 01:12:07 +0900 Message-Id: <20221024161213.3221725-1-senozhatsky@chromium.org> X-Mailer: git-send-email 2.38.0.135.g90850a2211-goog MIME-Version: 1.0 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1666627946; a=rsa-sha256; cv=none; b=zk4olptzYqTek2n9LH4NlkgV30g4u4jmG6yDdO2VCwpgSrhE2+Ql4HNeSjwlxqF8Ol6ZOG ODbSV0zJfz9YvPpr+MW6e3WIKMlnRzdMjd8xxc4Hq4zj4sIKklKtdPd/83RAsh1eQ6ZRcq 4rfvtjHK/oyi591e7OTayCrn4cQgm2I= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=gxgpngwc; spf=pass (imf16.hostedemail.com: domain of senozhatsky@chromium.org designates 209.85.210.170 as permitted sender) smtp.mailfrom=senozhatsky@chromium.org; dmarc=pass (policy=none) header.from=chromium.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1666627946; 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:references:dkim-signature; bh=Dt6vGfaF+WpKB2crlph/A5DawhX6V7zOYBBnigw00K8=; b=xqe+IBV3RJ8ZZgb7m/jxQrw+kuQ0Sd1FI6EQPAiiFpS+bElklox/opJ3XWVZz1yAJ9hneS k28c4RUrvps7zM/liuyZJwbKDou3RWzEAtuvQnrGRY/z0YqT3W3gC1bSvyaeupqaVblm8h BGBDxif9U4TsRAgFxDd+9f1MANv4N+o= X-Stat-Signature: cupq61forxyq174c7bfdafghkq3ky9rp X-Rspamd-Queue-Id: 4341818003E Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=gxgpngwc; spf=pass (imf16.hostedemail.com: domain of senozhatsky@chromium.org designates 209.85.210.170 as permitted sender) smtp.mailfrom=senozhatsky@chromium.org; dmarc=pass (policy=none) header.from=chromium.org X-Rspam-User: X-Rspamd-Server: rspam05 X-HE-Tag: 1666627946-903789 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: Hello, Some use-cases and/or data patterns may benefit from larger zspages. Currently the limit on the number of physical pages that are linked into a zspage is hardcoded to 4. Higher limit changes key characteristics of a number of the size clases, improving compactness of the pool and redusing the amount of memory zsmalloc pool uses. For instance, the huge size class watermark is currently set to 3264 bytes. With order 3 zspages we have more normal classe and huge size watermark becomes 3632. With order 4 zspages huge size watermark becomes 3840. Commit #1 has more numbers and some analysis. Sergey Senozhatsky (6): zsmalloc: turn zspage order into runtime variable zsmalloc/zram: pass zspage order to zs_create_pool() zram: add pool_page_order device attribute Documentation: document zram pool_page_order attribute zsmalloc: break out of loop when found perfect zspage order zsmalloc: make sure we select best zspage size Documentation/admin-guide/blockdev/zram.rst | 31 +++++-- drivers/block/zram/zram_drv.c | 44 ++++++++- drivers/block/zram/zram_drv.h | 2 + include/linux/zsmalloc.h | 15 +++- mm/zsmalloc.c | 98 +++++++++++++-------- 5 files changed, 145 insertions(+), 45 deletions(-)