From patchwork Wed Oct 26 11:29:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Senozhatsky X-Patchwork-Id: 13020474 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 B5BFCC433FE for ; Wed, 26 Oct 2022 11:30:06 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E8E1A8E0002; Wed, 26 Oct 2022 07:30:05 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E184A8E0001; Wed, 26 Oct 2022 07:30:05 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CB8DA8E0002; Wed, 26 Oct 2022 07:30:05 -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 B9DEF8E0001 for ; Wed, 26 Oct 2022 07:30:05 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 7F177A0F2B for ; Wed, 26 Oct 2022 11:30:05 +0000 (UTC) X-FDA: 80062881570.02.378D881 Received: from mail-pg1-f179.google.com (mail-pg1-f179.google.com [209.85.215.179]) by imf17.hostedemail.com (Postfix) with ESMTP id 1960D4003C for ; Wed, 26 Oct 2022 11:30:04 +0000 (UTC) Received: by mail-pg1-f179.google.com with SMTP id f9so10082837pgj.2 for ; Wed, 26 Oct 2022 04:30:04 -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=UlcqHJTxWpBCQSOBGpz23ymej0kP4Ky/Ub6kb29VjcI=; b=D1uZ5Qngpyal5W7zsSpY3pKUSRQBuko1HALHelbDwkgJSXHiR55b712Jgelc9plbjP 5GOszbnAKr6bi9AZDih7QDPY0welW+lpMJz6UGatk5XBlbxs2roNRLFCKUmZxv6fP3JV GEeBLp3RML9mUfO1izOwqpMareEU8odQ1+J/Q= 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=UlcqHJTxWpBCQSOBGpz23ymej0kP4Ky/Ub6kb29VjcI=; b=a8biKGFEWMVUBiUcTJam7btcB8ei+p2tfuNoFTNztfpMzt0lUNKORNbJAHVjG4TbBy I//YV5JxLiUT4U4GyhMqGydSktW71P3Ci5wxeZhxIvJDet7v1JsKK6nkouZs2YmUrbPw m5mUKqo/MdyDVL1+j40S8IydY2qprmh9zk5eybEFJasUPaRS1zoKetXjumuPNnF/mZEQ dq47eRG+3ZwrEWATltFBa/m2q4m/aL1EUtzYb2nRKSTBl/El6wdo/xLPzlw15NIeP2z5 RtOq7pq9v0+IiR4DGaTaUn1GMkw3AOlw3zTfXotRUP38gQrm+/JTaibxEFFiOyltnzZ7 LaWg== X-Gm-Message-State: ACrzQf0mPK2O4lDbGGpkzc4aWi0UgB9WD8wiaAptkyNvMMWXtL6RoqzG ydNB8+TbIkkvGgWcVmQAC1YZOw== X-Google-Smtp-Source: AMsMyM4Gj3CqIvbqhXM40PM/XV6jYpl+nGQ9OM9VFSoOKgZ10F/rxzemjRmIGDIKdkJ9T/ef9ps80w== X-Received: by 2002:a05:6a00:32c9:b0:56b:a54e:68be with SMTP id cl9-20020a056a0032c900b0056ba54e68bemr19434184pfb.16.1666783803883; Wed, 26 Oct 2022 04:30:03 -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.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Oct 2022 04:30:03 -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 0/9] zsmalloc/zram: configurable zspage size Date: Wed, 26 Oct 2022 20:29:24 +0900 Message-Id: <20221026112933.4122957-1-senozhatsky@chromium.org> X-Mailer: git-send-email 2.38.0.135.g90850a2211-goog MIME-Version: 1.0 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1666783805; 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=UlcqHJTxWpBCQSOBGpz23ymej0kP4Ky/Ub6kb29VjcI=; b=8B8HNJPGZ0rQV8eHDoD/ttwbowE6XK6gd6IOdowkJw6RcjTLL0oUHp+X4mi/Z/YUFSOsyl FNRKj9VCYWztsiX36GMFS7oiQG9bDgxVBEAJ0pfg/eirwQJvt/vmnU/ycHDXtcWZPy+azY 9xf5NODe1QknV+yFPZjQNFqwVIUo/TE= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=D1uZ5Qng; spf=pass (imf17.hostedemail.com: domain of senozhatsky@chromium.org designates 209.85.215.179 as permitted sender) smtp.mailfrom=senozhatsky@chromium.org; dmarc=pass (policy=none) header.from=chromium.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1666783805; a=rsa-sha256; cv=none; b=aOfi4c4GtFTd14usUfpAwlrDNtRd1BuSCy3xvbm5/TOY+84OKPQziTP9ikCICl9nMEfSsc k+osQocRHX6PKIswJPZZ8Sc2VpU4G6s7U9HxUeXpjHF+YhQ4fibpyvVyXuqdBxqbn0TcJj GNBZwhsmCodSHAydolAmoVPFMZowrkY= X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 1960D4003C X-Rspam-User: Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=D1uZ5Qng; spf=pass (imf17.hostedemail.com: domain of senozhatsky@chromium.org designates 209.85.215.179 as permitted sender) smtp.mailfrom=senozhatsky@chromium.org; dmarc=pass (policy=none) header.from=chromium.org X-Stat-Signature: g8u5betukpzqjc6knkc1mujebxctgkjh X-HE-Tag: 1666783804-806011 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000029, 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 0001 commit message. 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 | 114 +++++++++++++------- 5 files changed, 178 insertions(+), 58 deletions(-)