Received: by 2002:a05:6358:111d:b0:dc:6189:e246 with SMTP id f29csp187140rwi; Sun, 30 Oct 2022 23:05:23 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5fBEd+UGVOxRAP7n3cNN7FFnI90FoTZyzTJleD3iKdKAY0014iFxwcYNxWpoadRxNBbjQ4 X-Received: by 2002:a65:5583:0:b0:461:25fe:e982 with SMTP id j3-20020a655583000000b0046125fee982mr11276541pgs.4.1667196323323; Sun, 30 Oct 2022 23:05:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667196323; cv=none; d=google.com; s=arc-20160816; b=ddd8ia2MALbnCTFL4P7fwHPiAP0el/q5ZZsVGkF5kS6/Pr4T22Nwl1DiPzWIyr3Hw3 YaAmq7KXN9taR08/6/24havcGxbthZBIHvME6Q65/z15Z+YneEOY1Qx7TzJ8oBkFnohQ ABf0qPZ/WBcY+/MawdJozdKwkPxUlg1UmMHalGRWaNvBwmPSWYGNtAMKbQl6mb5e4157 ep8Kj/B7VpRzp9qDD2DvRF+53tOwEZMOXFCIFhjgNohQ/pWko7+Ho9QX7u9KfH9z1CXm U/9wKqQi2XpCcFaD3oSye+oaINl8GQq6U+Pt9DFLrxP04yh8D5TYWqGKILnOzVyV82zH ecFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=qYzHeSSWpBV9igzsiV6R7/nw1z0St+lje5YCFrJ9iR8=; b=x5qBQwzyI5jn36cDmEdjI+eT/xUKhw9hW1qGGkpMa1yCo0Ijj3U64uHgc6U0v8foKC 3BJIQNMWanqS8mLqYuL0C1IblzM69N2t8EyAFofCBXXtDs3VjBznqF0CpAejp28RtLQf NU5gDKiZzznuhroF5aemvJAJsgAPsiFqmhgfbKBzrkcR2FDRlvbv2k8dH+EPvtpLgoga HyOQIq2HuVHEIqDCVMYAiArLskRh3vjiNvBdnTQTf22Cpt8aFyV/RLIuMnCGlg/46rTs 6XIENNjBJKPjPdeE/MF7PEmTQy+lcEqPa4qCDF19idKWuv25HVLBivZnWBPngnQPSsZJ Ph0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Oz+OOjNr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z17-20020a1709028f9100b001729cfb3cb5si6521438plo.610.2022.10.30.23.05.09; Sun, 30 Oct 2022 23:05:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Oz+OOjNr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229772AbiJaFlU (ORCPT + 99 others); Mon, 31 Oct 2022 01:41:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53260 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229752AbiJaFlS (ORCPT ); Mon, 31 Oct 2022 01:41:18 -0400 Received: from mail-pg1-x533.google.com (mail-pg1-x533.google.com [IPv6:2607:f8b0:4864:20::533]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F283767B for ; Sun, 30 Oct 2022 22:41:17 -0700 (PDT) Received: by mail-pg1-x533.google.com with SMTP id h2so9823504pgp.4 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=prU+Dr2TbQIorlHFlaF6+1b+PHro4ES7YqS/Z+J+Sx+tqewcY1gu/DiTXtCS1QlPPi xTmVyBddfIsvJwsL4sxUklvM6Md3Lc8KjO+17BB7SdMbH6Bd/FE6XdvgGiBNGk+zGZTm diq8hVOWGdoUYYhnTw4J1ph6LyHfXxYBwLWgz/KDjt3W5+P+3t/BJWShX6bH3K5Kbp6D k8mhnRAolEgPVhgkLXx+5sqJv0aJ75lq6goGPpw+N9uVJTMw0fZqpYpC3JiQzSd3KtdI Na6xGHwPxsRFgPS+dFCFuqhoX0mq8qcxiFtN+J5rzg7ZmKHXekiCnYv7CFONkjtU/VRv 5wgQ== X-Gm-Message-State: ACrzQf0KyvLhVlPabc/iwKvm8YcK6e7gIc2ImBibWQGNlF7eB5Zl1y5C 2OlSH3Th+KVU+2q4dKLVT4xoeQ== 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 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(-) -- 2.38.1.273.g43a17bfeac-goog