From patchwork Mon Oct 31 05:40:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Senozhatsky X-Patchwork-Id: 13025389 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 45345FA3740 for ; Mon, 31 Oct 2022 05:41:20 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 80F3F6B0071; Mon, 31 Oct 2022 01:41:19 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7BF8D6B0073; Mon, 31 Oct 2022 01:41:19 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 688D66B0074; Mon, 31 Oct 2022 01:41:19 -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 3E7326B0071 for ; Mon, 31 Oct 2022 01:41:19 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id D558040B68 for ; Mon, 31 Oct 2022 05:41:18 +0000 (UTC) X-FDA: 80080146636.18.D4F7D9C Received: from mail-pf1-f174.google.com (mail-pf1-f174.google.com [209.85.210.174]) by imf23.hostedemail.com (Postfix) with ESMTP id 3D420140008 for ; Mon, 31 Oct 2022 05:41:18 +0000 (UTC) Received: by mail-pf1-f174.google.com with SMTP id k22so9804553pfd.3 for ; Sun, 30 Oct 2022 22:41:17 -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=qYzHeSSWpBV9igzsiV6R7/nw1z0St+lje5YCFrJ9iR8=; b=Oz+OOjNr80VG+44uo2/7Z8ABc9d+XbNkC32w/HOs2qRoQep/xN6GVFC7laUxKIaGIZ jvLHCD3VnqTHGasgauVDVFlA/b4QooZvDWvvxT96NaEYZDWEmRkro0vBo28be7quUMOf XI+jLl46Kd3uEmNNgyfERpK/yxg7hf5I8//DY= 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=qYzHeSSWpBV9igzsiV6R7/nw1z0St+lje5YCFrJ9iR8=; b=l5dN1hLzV1jt9jT9TiD6nkQvNB8mOwB5LzXL+nFnFcSWoY50F0DGy5T8bDl85newGE 2opjTKr5AmWzyRo4AT/lRA8tmebZqySosDVn6rdvfK6tZzxiFzAS48G4zp0QGl20dJs2 7Zb2sMyNdYfy6xDbCIkFN7+PHXpVP6ldp4+u9Oz476dVWppQHgDQx7M8o5qI4Ygo5j6Q O6yf0Y7UPPH74eWMnRq/tQw4CcBFTqk6cxVWsiMXKY3Q8CYpJH12w3BKuXrEK9tu0hpH Oc4VJyrwVWv0bA4/jYegL9vY/ldExVaoMPTI1Knfzpe3wyx7cMYnnQD86aVSLTqpwUEe VEGw== X-Gm-Message-State: ACrzQf00jV16hyKDZ9w66aTM2s0WlbmL2GNxdshq/ywbBAfnBAVRzXTH 0OXCo5LXDxUsnf9dmViO0GVYMA== X-Google-Smtp-Source: AMsMyM6H6wbT7GWuWfAO4ELtIj4GeOWzzfNWRL1yQxKQ5h8hV4XDZcz8i+Ys2B7yFIRDStZTEqZ1Dw== X-Received: by 2002:a62:3281:0:b0:56d:385:149b with SMTP id y123-20020a623281000000b0056d0385149bmr12610665pfy.29.1667194876904; Sun, 30 Oct 2022 22:41:16 -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.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 30 Oct 2022 22:41:16 -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 0/9] zsmalloc/zram: configurable zspage size Date: Mon, 31 Oct 2022 14:40:59 +0900 Message-Id: <20221031054108.541190-1-senozhatsky@chromium.org> X-Mailer: git-send-email 2.38.1.273.g43a17bfeac-goog MIME-Version: 1.0 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1667194878; a=rsa-sha256; cv=none; b=8d0jXofyM8OMjuJjeaTf2n9TrMxiMhnPjhNd+zmhYMBya4UOaAkWEoyxlL0km1orpCfdzC FzsPLwiSh5bjTmKd6TZFiSFLwtxszvPw2UY8fnUX2hljTCImnRWOI5P7gglGYIfbXkdPuH t7+SkKes0ELgXdZ+DD2cndMxk89b/1k= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=Oz+OOjNr; spf=pass (imf23.hostedemail.com: domain of senozhatsky@chromium.org designates 209.85.210.174 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=1667194878; 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=qYzHeSSWpBV9igzsiV6R7/nw1z0St+lje5YCFrJ9iR8=; b=CiufhOP5wPUiRBKcV0SQtUp2PxN9fXV9Oxd+qUfBpzT5QEqESIU84FlRQRqpt47R815WNB bsl6ZvuoOjwbJwb0vfRCtA+FszFEGpcHF4S2t2EOB93j9zl3iTOGnWhSOtaIR/NoyOC9UB GtWkrbgJMl5P78pGcPSXnkmLyXWd6yY= X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 3D420140008 X-Rspam-User: X-Stat-Signature: m3xz5m8djx38z9oijtg4q9jqo6ga9wb9 Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=Oz+OOjNr; spf=pass (imf23.hostedemail.com: domain of senozhatsky@chromium.org designates 209.85.210.174 as permitted sender) smtp.mailfrom=senozhatsky@chromium.org; dmarc=pass (policy=none) header.from=chromium.org X-HE-Tag: 1667194877-102878 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 classes, improving compactness of the pool and redusing the amount of memory zsmalloc pool uses. More on this in 0002 commit message. v4: -- Fixed type of the max_pages_per_zspage (kbuild reported a "warning: right shift count >= width of type" warning) -- Renamed max_pages_per_zspage variable v3: -- Removed lots of text from 0002 commit message. Now it's shorter and simpler. v2: -- Cherry picked a patch from Alexey (minor code tweaks to move it ahead of this series) -- zsmalloc does not require anymore pages-per-zspage limit to be a pow of 2 value, and overall doesn't use "order" any longer -- zram does not require "zspage order" (pow of 2) value anymore and instead accepts an integer in [1,16] range -- There is no global huge_class_size in zsmalloc anymore. huge_class_size is per-pool, since it depends on pager-per-zspage, which can be different for different pools. -- There is no global huge_class_size in zram anymore. It should be per-pool (per-device). -- Updated documentation -- Fixed documentation htmldocs warning (Stephen) -- Dropped get_pages_per_zspage() patch -- Renamed zram sysfs knob (device attribute) -- Re-worked "synthetic test" section in the first commit: more numbers, objects distribution analysis, etc. Alexey Romanov (1): zram: add size class equals check into recompression Sergey Senozhatsky (8): zsmalloc: turn zspage order into runtime variable zsmalloc: move away from page order defines zsmalloc: make huge class watermark zs_pool member zram: huge size watermark cannot be global zsmalloc: pass limit on pages per-zspage to zs_create_pool() zram: add pages_per_pool_page device attribute Documentation: document zram pages_per_pool_page attribute zsmalloc: break out of loop when found perfect zspage order Documentation/admin-guide/blockdev/zram.rst | 38 +++++-- drivers/block/zram/zram_drv.c | 63 +++++++++-- drivers/block/zram/zram_drv.h | 7 ++ include/linux/zsmalloc.h | 14 ++- mm/zsmalloc.c | 112 +++++++++++++------- 5 files changed, 176 insertions(+), 58 deletions(-)