Received: by 2002:a05:6358:53a8:b0:117:f937:c515 with SMTP id z40csp4986559rwe; Mon, 17 Apr 2023 23:48:36 -0700 (PDT) X-Google-Smtp-Source: AKy350ZAvIplgRrOY6s+a+BK5HE4xrLcaclr3qG7/ass+7FSqotIMLn2KmG/xryldmq4gfFwTnzB X-Received: by 2002:a05:6a00:138d:b0:63d:260d:f9dd with SMTP id t13-20020a056a00138d00b0063d260df9ddmr7063968pfg.33.1681800516045; Mon, 17 Apr 2023 23:48:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681800516; cv=none; d=google.com; s=arc-20160816; b=koeWI6QR5z9TZSRHWV0vVTpNwGOTOy+38Geq4KfuvEboItkze1CDM0kVNI0PkQIFpX PkecQpC3L6DaC0BQT8UtrDs7QSA1ZhkMDj2NMqrMJknnGHOESe2XV9V+Vi8/SyZm+xIm FzevQekPBFK+LNuaITxTYAzTlArUxcziBDZhT/HQJUhprH8STvsSFgTDOsT7EMpK3tqy jgB7Qsr+ravtQgAFuETENzkqc9fDYXSs6nlP0PBfOOJN4sST3kfd3Sj0qhv5KyJoKW38 drcVNzXXA7gCYRdTY5cxzY8X8PJSvjiOuWh2AQ5vAWyQqYuusU6dNbhW3/mW0y+t6tZz AZZQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=NmVhwWOMVBSjx7NTACx4GB75SU5JQuvCsHOYaqd9NSk=; b=po4oQJagT6Vk6405Ang1leYdv2kj1nc7J2ANpzW9Yu7hLwk3ih6kyawpN90HA1HEOZ ArEiyMVGJrmbLxC9F73CYjjbja1NULQNEwRplcBBMzDWyaKt8KVsTOoKyDTZlg0khjDe 8yQKjAjakSqO3knKDNPL0Axn4DnxzFvWBuTp2FHXJ+fYjJa5E9M7Ecl01cY+2wqtOeDh i+J48bectgBvNayqKv/OOLZRrkUDalsvyezFwo7Yx0geWyeTLV4yI4ratBtgFlfE5ebk e4cAS3uzU5XvHNyo4apTDmmUx2eNvb/I+vdImB7NAvS4z9A3ttRoxEe2aO2MsRU5EHIN yKQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sberdevices.ru header.s=mail header.b=jTbfDR0v; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=sberdevices.ru Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d16-20020a631d50000000b0051f56bf066csi802378pgm.105.2023.04.17.23.48.21; Mon, 17 Apr 2023 23:48:36 -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=@sberdevices.ru header.s=mail header.b=jTbfDR0v; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=sberdevices.ru Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230494AbjDRGZa (ORCPT + 99 others); Tue, 18 Apr 2023 02:25:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229527AbjDRGZU (ORCPT ); Tue, 18 Apr 2023 02:25:20 -0400 Received: from mx.sberdevices.ru (mx.sberdevices.ru [45.89.227.171]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CE50C119 for ; Mon, 17 Apr 2023 23:25:18 -0700 (PDT) Received: from s-lin-edge02.sberdevices.ru (localhost [127.0.0.1]) by mx.sberdevices.ru (Postfix) with ESMTP id E48BC5FD61; Tue, 18 Apr 2023 09:25:15 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sberdevices.ru; s=mail; t=1681799115; bh=NmVhwWOMVBSjx7NTACx4GB75SU5JQuvCsHOYaqd9NSk=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type; b=jTbfDR0vCa8wixwiTa1ZFpFkcYWqDSz7h34TOHXoCMYZDLuRKplSEvBhjoRu8Bp2X a88zG+i0WWVmtaixqMqIxvxWdHXS1T2J8Z6dHypHepW+44ytxQU9BNZtP2TsYtFrez mOyGV4lU52paulufz9uU3v22khFsroHTNkP3pTB/fvVHgqtPSm6pDm/sqbdEQLc7B5 FO9Y4d+YSDdd77SSg3fWoQr1VVQ2ORAly4jBUyRTMJvmBFvu/+HKBmq09CFFPPUz4I UJVFTGtMNWoQrCPNHGZ1W2feWtVHUtlINJxygGgn78j4caTZZBXFF9ewYNpTjvUyc2 xlkq5twUOFAuw== Received: from S-MS-EXCH01.sberdevices.ru (S-MS-EXCH01.sberdevices.ru [172.16.1.4]) by mx.sberdevices.ru (Postfix) with ESMTP; Tue, 18 Apr 2023 09:25:15 +0300 (MSK) From: Alexey Romanov To: , , CC: , , , Alexey Romanov Subject: [RFC PATCH v1 5/5] zram: add pages_folded to stats Date: Tue, 18 Apr 2023 09:25:03 +0300 Message-ID: <20230418062503.62121-6-avromanov@sberdevices.ru> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20230418062503.62121-1-avromanov@sberdevices.ru> References: <20230418062503.62121-1-avromanov@sberdevices.ru> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.16.1.6] X-ClientProxiedBy: S-MS-EXCH02.sberdevices.ru (172.16.1.5) To S-MS-EXCH01.sberdevices.ru (172.16.1.4) X-KSMG-Rule-ID: 4 X-KSMG-Message-Action: clean X-KSMG-AntiSpam-Status: not scanned, disabled by settings X-KSMG-AntiSpam-Interceptor-Info: not scanned X-KSMG-AntiPhishing: not scanned, disabled by settings X-KSMG-AntiVirus: Kaspersky Secure Mail Gateway, version 1.1.2.30, bases: 2023/04/18 02:02:00 #21122658 X-KSMG-AntiVirus-Status: Clean, skipped X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 This counter show how many objects folded into single one at the zsmalloc allocator level. Signed-off-by: Alexey Romanov --- Documentation/admin-guide/blockdev/zram.rst | 2 ++ drivers/block/zram/zram_drv.c | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Documentation/admin-guide/blockdev/zram.rst b/Documentation/admin-guide/blockdev/zram.rst index e4551579cb12..349f13a2d310 100644 --- a/Documentation/admin-guide/blockdev/zram.rst +++ b/Documentation/admin-guide/blockdev/zram.rst @@ -209,6 +209,7 @@ compact WO trigger memory compaction debug_stat RO this file is used for zram debugging purposes backing_dev RW set up backend storage for zram to write out idle WO mark allocated slot as idle +fold WO trigger memory folding ====================== ====== =============================================== @@ -267,6 +268,7 @@ line of text and contains the following stats separated by whitespace: pages_compacted the number of pages freed during compaction huge_pages the number of incompressible pages huge_pages_since the number of incompressible pages since zram set up + pages_folded the number of pages freed during folding ================ ============================================================= File /sys/block/zram/bd_stat diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c index 06a614d1643d..3012b297ade5 100644 --- a/drivers/block/zram/zram_drv.c +++ b/drivers/block/zram/zram_drv.c @@ -1242,7 +1242,7 @@ static ssize_t mm_stat_show(struct device *dev, max_used = atomic_long_read(&zram->stats.max_used_pages); ret = scnprintf(buf, PAGE_SIZE, - "%8llu %8llu %8llu %8lu %8ld %8llu %8lu %8llu %8llu\n", + "%8llu %8llu %8llu %8lu %8ld %8llu %8lu %8llu %8llu %8lu\n", orig_size << PAGE_SHIFT, (u64)atomic64_read(&zram->stats.compr_data_size), mem_used << PAGE_SHIFT, @@ -1251,7 +1251,8 @@ static ssize_t mm_stat_show(struct device *dev, (u64)atomic64_read(&zram->stats.same_pages), atomic_long_read(&pool_stats.pages_compacted), (u64)atomic64_read(&zram->stats.huge_pages), - (u64)atomic64_read(&zram->stats.huge_pages_since)); + (u64)atomic64_read(&zram->stats.huge_pages_since), + atomic_long_read(&pool_stats.pages_folded)); up_read(&zram->init_lock); return ret; -- 2.38.1