From patchwork Thu Oct 27 04:26:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Senozhatsky X-Patchwork-Id: 754 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp23399wru; Wed, 26 Oct 2022 21:29:33 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4WkptwtH+i3ROfRZUII7A+GHyXCrMke9sWXtG9tj+UZXdlcgAIGSIQeNoA7kdbQFMmC27+ X-Received: by 2002:a05:6402:78c:b0:461:a7f3:2d61 with SMTP id d12-20020a056402078c00b00461a7f32d61mr19951253edy.84.1666844973327; Wed, 26 Oct 2022 21:29:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666844973; cv=none; d=google.com; s=arc-20160816; b=Tt1cHXphZTj+zp0CtCaU8vJktuemcFtrL20o2yr9uIwnjkH5NsjIYqsQhMUAk0/ggU BdSfJwBXRWMQnrlfHqb4IiseVVa04b6QSctR80/7XKoeED4JItVQxBEAH+qqf4lc4n85 VDLmToennblrRBwW4uASzuZxZ7U1f0LVnwOaPzYOpzP4VPsT0nlL+WHxIZazR6A8ZsAt +kOaBPwqalWUBnUp7Ae35OcMUkym5lFCiXZfJf4x5fwyU4xg4AX1nHJW69Q28zRfp32C INnrBo8dqgDzdf5+QIm72ZO74d6me1jY+WPkvBNj1dr2l4/B7816ic8dK5RJAfUmRluf Q0IQ== 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=sLpRMNQkYbVj6lyrmRrOxuuwmgiytFPuZn2IVFPntgM=; b=sgFHOe0kgHbL6UXmKakfCF7FZ7Pv9SxjmoXQ9lzVJOM9ye+6f7aY78EhFaeU4IU1nB wL1ZDkBK/2g+fIJ3j2xhCCIPUVYQ0anaTCZdbnl5UFexiFZGnBZKRINv18haeDCNnkce uhxoN53j+U5HFyl4tjywDh9ItrYTmBQ3kxOwql5m1qykZmKFCOceekWc23VDlYZHj69U mCXtzcNabKuPaHfdVTqsE2jPBX01asIjRmsk9R6TCy0X/u2HFjKf9iX66+MIuNZGOpTm ZHBNCBsHoHgPJqZdjkFhfIhziRL0dVmwsxqLAHggsdwvZx6f0CBpVXKNJPBG8ls6lybv rp1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=h0chSoTr; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v14-20020a056402348e00b0045be16903d0si622236edc.310.2022.10.26.21.29.09; Wed, 26 Oct 2022 21:29:33 -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=h0chSoTr; 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 S233725AbiJ0E1A (ORCPT + 99 others); Thu, 27 Oct 2022 00:27:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46408 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229691AbiJ0E06 (ORCPT ); Thu, 27 Oct 2022 00:26:58 -0400 Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 82535DBE42 for ; Wed, 26 Oct 2022 21:26:57 -0700 (PDT) Received: by mail-pj1-x1036.google.com with SMTP id m2so398898pjr.3 for ; Wed, 26 Oct 2022 21:26:57 -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=sLpRMNQkYbVj6lyrmRrOxuuwmgiytFPuZn2IVFPntgM=; b=h0chSoTr9LjZO+zENyYG/Z5Q+FKzIaov9HQFxUG64gBu+2GKz2R/9u3u7+0MU7R0wt vlHlWa+fYEWocbNl7x13wdFDgrbF00lwqinD3Zy6lyfAqx3xQPrUO/ffW5tSXdn0Ca8O Yyvq6cq3UbLn/hUgrAJYeuLOza1Wv9SvmKomk= 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=sLpRMNQkYbVj6lyrmRrOxuuwmgiytFPuZn2IVFPntgM=; b=mCbGOQHoVx7oQSZCv+vaWumge8HJP0R4y49eap8x3yNVzNvn2lGsk0+HCpKqKUNmMD or2voWJalCs2YbnsDN1OuZcVSWH/4klWIIUth3RCOg+GAW9CkKKmRMWKiw6xRzE74Gj9 VILvkT+7wvyL81JuVUgyTfUn9h7+je2C50J2xyfIM+F1g51Rrh1gt2akGTe9WorKxmla oK5ph55R1eOHArywKOKcrh/ZQRcbpZMF1/9UTmqb6BCATSpqPZB/uXZyzVi8qoMrnDA5 GD4UaAO4gVnpVx8Opgmk2NzWtmdD+MOsG205ppCEiZKJl7TE/KqGMPIeyvhtrQOIPKeQ YKrA== X-Gm-Message-State: ACrzQf33dYTtVyKtH/D8Wfv7wVIymDtK0zEFjTn8+O/tvAtiEi2IjGLX sariJCyD2wO+Sqv0fgkEtHDX0Q== X-Received: by 2002:a17:902:848c:b0:17a:b4c0:a02b with SMTP id c12-20020a170902848c00b0017ab4c0a02bmr47126465plo.122.1666844816979; Wed, 26 Oct 2022 21:26:56 -0700 (PDT) Received: from tigerii.tok.corp.google.com ([2401:fa00:8f:203:30f2:4501:65fa:df12]) by smtp.gmail.com with ESMTPSA id w23-20020aa79557000000b00565c8634e55sm203140pfq.135.2022.10.26.21.26.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Oct 2022 21:26:56 -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: [PATCHv3 0/9] zsmalloc/zram: configurable zspage size Date: Thu, 27 Oct 2022 13:26:42 +0900 Message-Id: <20221027042651.234524-1-senozhatsky@chromium.org> X-Mailer: git-send-email 2.38.0.135.g90850a2211-goog MIME-Version: 1.0 X-Spam-Status: No, score=-2.6 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747813634713674407?= X-GMAIL-MSGID: =?utf-8?q?1747813634713674407?= 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. v3: -- Removed lots of text from 0001 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 | 114 +++++++++++++------- 5 files changed, 178 insertions(+), 58 deletions(-)