Message ID | 20221024161213.3221725-1-senozhatsky@chromium.org |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp574240wru; Mon, 24 Oct 2022 10:40:09 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7tGYQmV6bsAL38VvEdhiKAbVLdwOMturzF20O9ZXjhduYhigh07K9HjrDHRAwjhxegyBZ0 X-Received: by 2002:a17:90b:3805:b0:20d:4e77:371f with SMTP id mq5-20020a17090b380500b0020d4e77371fmr40009665pjb.170.1666633209360; Mon, 24 Oct 2022 10:40:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666633209; cv=none; d=google.com; s=arc-20160816; b=Rj8sKS9Ybt1fNEfYRNgxIZKiZO8HWcwe2kXtv80/0c2xouFhY4KUcZ8mLPTkitYMgs fqVZUc9aDb22M5yfxJFIr82YIy6QGpfnPl+1xIUC76B7rxT0pm2AGXSJpVHxGAfLzeyM ffCj5aeEn0U8nwR3x542xZYJQe3O/vs9I0wVwfEO4kUlJBkO3il6mm4t3qLvmAqv1CVs cN+625plfl0upLMgA/ct6i07MX0WGyd7btlhf0rqmJEiaMKXbqFjQWnt0rTNccR+NDpZ tzxTEp5c36/BDLxPUxDpuc5+kFpSxsXPUj9UYJSA/T+TNYVdhB3/LAOFOCIMprDLza9y XzAA== 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=Dt6vGfaF+WpKB2crlph/A5DawhX6V7zOYBBnigw00K8=; b=0sJSjlKFYuYYOGYfphWrd673Lb+483bCtSkKhIoV+L7vm43qmfR9BwPGryvKkKvYSe cYruMM4bUKcF6DvwWipBAhcsusxo7CaCuwA7SOYkovseE83bzZRGeaALEBqve9P37ClG BEO89zUqLkP8fpi5esrp5DmlnxqJ8fDll78urT5FOAC7cmQ/y2NzhmSU3vraYTZFgWvv iGwoqgqunTebD/Z4AtyWY+UoutU9UIdoCqpWJk6deWWnhZTvxEaa62ckwWCC+acT8XR6 abcip+5cr84NpjeRGk7jOgdlRxA6cPSBbNFbW8bjzPfRhBgy0JmpRLhe8cLEVdGALtGq GNRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=gxgpngwc; 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 6-20020a630906000000b0046ed85dbdf5si81889pgj.100.2022.10.24.10.39.55; Mon, 24 Oct 2022 10:40:09 -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=gxgpngwc; 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 S232981AbiJXRji (ORCPT <rfc822;pwkd43@gmail.com> + 99 others); Mon, 24 Oct 2022 13:39:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49828 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234714AbiJXRjM (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 24 Oct 2022 13:39:12 -0400 Received: from mail-pg1-x52b.google.com (mail-pg1-x52b.google.com [IPv6:2607:f8b0:4864:20::52b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9DCB06CF60 for <linux-kernel@vger.kernel.org>; Mon, 24 Oct 2022 09:14:53 -0700 (PDT) Received: by mail-pg1-x52b.google.com with SMTP id f9so4658856pgj.2 for <linux-kernel@vger.kernel.org>; Mon, 24 Oct 2022 09:14:53 -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=nF/zY2DT3rcfam5yRjv7DLPz4VzDA6mzb82fiAHJLeg0wdG5xD4f2W/mSqyrXicScE psVYGO0DTcAfvdOmMcKLsZSbaAjjOC3ZK0aUGgPquEl1nV8iHU8MXuvW6qYLmCnVddex XXSrhMQdyPInZhQCWA5JdpQFW99PtZHqtoNI2yyF6AMMSg/XG4pjexMX6CsPNhZIPZkW l6GDElY62aasuinsOf7LV5Lqx/D1lK4Vxh1W+POVsBIkidkupBuY8KvxZvqTxuSNr9V4 N10uGTuCmC8WP4zjnTvl6QqhUdBOwR0JpWSyo4tyn8+eWlh74wapdv+tG3IVFXF3cRzv bi2g== X-Gm-Message-State: ACrzQf2RtN5TTKmZZ1IKP7S9xfZKfu5jbC41jwmMz0py35FUuMDPtLK2 yuHzvIuqho554xQDG9S91Luo445jRxnQBw== 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 <senozhatsky@chromium.org> To: Andrew Morton <akpm@linux-foundation.org>, Minchan Kim <minchan@kernel.org> Cc: Nitin Gupta <ngupta@vflare.org>, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Sergey Senozhatsky <senozhatsky@chromium.org> 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 Content-Transfer-Encoding: 8bit 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747591584119981610?= X-GMAIL-MSGID: =?utf-8?q?1747591584119981610?= |
Series |
zsmalloc/zram: configurable zspage size
|
|
Message
Sergey Senozhatsky
Oct. 24, 2022, 4:12 p.m. UTC
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(-)
Comments
On Tue, Oct 25, 2022 at 01:12:07AM +0900, Sergey Senozhatsky wrote: > 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(-) > Sorry, I can't cleanly apply this patch series due to conflicts in patch [1/6]. On what tree and commit the series is based?
On (22/10/25 10:26), Bagas Sanjaya wrote: > > Sorry, I can't cleanly apply this patch series due to conflicts in > patch [1/6]. On what tree and commit the series is based? next-20221024
On (22/10/25 01:12), Sergey Senozhatsky wrote: > 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 Andrew, I want to replace the last 2 patches in the series: I think we can drop `usedpc` calculations and instead optimize only for `waste` value. Would you prefer me to resend the entire instead?
On (22/10/25 13:30), Sergey Senozhatsky wrote: > On (22/10/25 01:12), Sergey Senozhatsky wrote: > > 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 > > Andrew, I want to replace the last 2 patches in the series: I think > we can drop `usedpc` calculations and instead optimize only for `waste` > value. Would you prefer me to resend the entire instead? Andrew, let's do it another way - let's drop the last patch from the series. But only the last one. The past was a last minute addition to the series and I have not fully studied it's impact yet. From a preliminary research I can say that it improves zsmalloc memory usage only for order 4 zspages and has no statistically significant impact on order 2 nor order 3 zspages. Synthetic test, base get_pages_per_zspage() vs 'waste' optimized get_pages_per_zspage() for order 4 zspages: x zram-order-4-memused-base + zram-order-4-memused-patched +----------------------------------------------------------------------------+ |+ + + + x xx x| | |___________A_______M____| |____M_A______| | +----------------------------------------------------------------------------+ N Min Max Median Avg Stddev x 4 6.3960678e+08 6.3974605e+08 6.3962726e+08 6.3965082e+08 64101.637 + 4 6.3902925e+08 6.3929958e+08 6.3926682e+08 6.3919514e+08 120652.52 Difference at 95.0% confidence -455680 +/- 167159 -0.0712389% +/- 0.0261329% (Student's t, pooled s = 96607.6) If I will have enough confidence in that patch I will submit it separately, with a proper commit message and clear justification.
On 10/25/22 10:42, Sergey Senozhatsky wrote: > On (22/10/25 10:26), Bagas Sanjaya wrote: >> >> Sorry, I can't cleanly apply this patch series due to conflicts in >> patch [1/6]. On what tree and commit the series is based? > > next-20221024 Hmm, still can't be applied (again patch [1/6] is the culprit). Please rebase on top of mm-everything. Don't forget to pass --base to git-format-patch(1) so that I know the base commit of this series. Thanks.