Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp5437591rwi; Mon, 17 Oct 2022 21:59:51 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7HG7Wz8sc4xQTLw6KNlNH5uBOfbgk4/oHGlSXzEtwvgkk38naTlLXBT13RwlpXIPSVgAkn X-Received: by 2002:a17:907:6d23:b0:78d:8f0f:1266 with SMTP id sa35-20020a1709076d2300b0078d8f0f1266mr893456ejc.762.1666069191170; Mon, 17 Oct 2022 21:59:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666069191; cv=none; d=google.com; s=arc-20160816; b=uthQmq53SIjNxvgxLaRtFUSN7uZarzv5ju9qLMVBE8PsP2KVFpQWdxEeW6O1PljWdE fha1+xuhYhoNhFuK7OpMBOevL9a6Kqoru+up4IKsdto1O5+AK2fFotOyHQNktHgo5uNW 8f0GsOWGtKZ0/nXgZw30Q9CWI92hvkigimCKjYc6qflyL1c09G9UIsOLfDDTrAA3yI3R +amYqGFZwXwMhs/AdcmeOqHVlO3PgIqBcT2g/TNPCIEMkGjZOIcr5HYy1xCIfE9juran C3S9vJ1yxygEpeSAqkIMrpNSUrdJ/FuDs4j3Be6UBZ3YVlJtPpYvO8mGd8qzxUamtR2I ZRTg== 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=xtQh7ZmjoyZo2F0qXeywbofevhcfT59MQNGpxOyNbx8=; b=NsSx2ea/Q8nOK1u1IH6JIy3l8GK+3cW3/GFDrbjfeSvV24yC5dm7D2JF6LTJRJWzKb x+csbhLfz1q+ekpmMdh5i7CMwNkuMXUXSr2p057YHB85eh7EcX7nF0oLLz786QzMa2V3 oCtg5rIsbqcGF4y03eFMv7FCJh0S0gZkEEPAz4ArsT+E+3VOe83uqKc1+Hw8rDLKVrE0 W1mXcdLB9R99uP96ynkJQrePRGBx87PMR7v6CHb212F6fJi38mFd+8pM+i6ufweLtztG P0YldItne3wRatGiOpIrSjMLc9VNRlnprZlTCsqXDWgYMLH9zDEIhXOUCY4Qgmm8vqeJ /Ogg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="Ez9/9h1l"; 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 ti5-20020a170907c20500b00787ad97302asi7616252ejc.863.2022.10.17.21.59.25; Mon, 17 Oct 2022 21:59:51 -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="Ez9/9h1l"; 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 S230118AbiJRE4r (ORCPT + 99 others); Tue, 18 Oct 2022 00:56:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59744 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229869AbiJRE4D (ORCPT ); Tue, 18 Oct 2022 00:56:03 -0400 Received: from mail-pf1-x431.google.com (mail-pf1-x431.google.com [IPv6:2607:f8b0:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 67DF3A220A for ; Mon, 17 Oct 2022 21:55:59 -0700 (PDT) Received: by mail-pf1-x431.google.com with SMTP id y191so13056696pfb.2 for ; Mon, 17 Oct 2022 21:55:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=xtQh7ZmjoyZo2F0qXeywbofevhcfT59MQNGpxOyNbx8=; b=Ez9/9h1lS/+dC1G6E7jdHeTIahEsqMGdrK+uwr+wyLQfJq+YLjzffrRXXk0guSR6Ye VzU5kwyeOgaqpli2PFTCX+fpqvNyEHxZoVc7VzgNecYXJnNNROFa4+6BvojEANHXNLHN Udu8/kOoLQRV0SokqX/ZR/orQ8KcP4PTdY21k= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xtQh7ZmjoyZo2F0qXeywbofevhcfT59MQNGpxOyNbx8=; b=CH9trWJhAo6hSop840Y6vivx5xop8jrgeJ3pOwASu3xaXjktllEcKdAGaz92nFn7HM dZ1DzFTgpIGPZAX0rBe5OOOsw7EETS44yNKpCLiLUfzjYsnXGc7CofPOLP/fL5xJNcRm dN9tV+tWE13pP5yuEUSE6DB3FTpNo+eP5aDszu5rM5TVkwQgiMA6zKP2KLk33d+CG/W6 fh3eJm4gV5un76D0wdDM17I6yPH71Sh3nCT4DHFjiIs4q3ERYyjugo6Takx2OfMGtLVa WTTC9spVuWGjZRHy9c7q54Fcy/PlbRsOSxLxXkIroCU+fDwpUjTTSUBzOMkrPHDDen0F jvmg== X-Gm-Message-State: ACrzQf2yf0vo0jVXZkhO7U8VpNWhwtj4zZXa12tRxPYTfJt5Mq/jLWW4 t+Fas6g7p1najzcfz2Ik/H4gPg== X-Received: by 2002:a05:6a00:1781:b0:561:7f7f:dc38 with SMTP id s1-20020a056a00178100b005617f7fdc38mr1384946pfg.42.1666068958685; Mon, 17 Oct 2022 21:55:58 -0700 (PDT) Received: from tigerii.tok.corp.google.com ([2401:fa00:8f:203:17a9:73b0:c262:eccd]) by smtp.gmail.com with ESMTPSA id p4-20020a170902e74400b0017b69f99321sm7549220plf.219.2022.10.17.21.55.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Oct 2022 21:55:58 -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 7/9] zram: Add recompress flag to read_block_state() Date: Tue, 18 Oct 2022 13:55:31 +0900 Message-Id: <20221018045533.2396670-8-senozhatsky@chromium.org> X-Mailer: git-send-email 2.38.0.413.g74048e4d9e-goog In-Reply-To: <20221018045533.2396670-1-senozhatsky@chromium.org> References: <20221018045533.2396670-1-senozhatsky@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.4 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 Add a new flag to zram block state that shows if the page was recompressed (using alternative compression algorithm). Signed-off-by: Sergey Senozhatsky --- Documentation/admin-guide/blockdev/zram.rst | 9 ++++++--- drivers/block/zram/zram_drv.c | 5 +++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Documentation/admin-guide/blockdev/zram.rst b/Documentation/admin-guide/blockdev/zram.rst index c916c2b9da55..010fb05a5999 100644 --- a/Documentation/admin-guide/blockdev/zram.rst +++ b/Documentation/admin-guide/blockdev/zram.rst @@ -466,9 +466,10 @@ pages of the process with*pagemap. If you enable the feature, you could see block state via /sys/kernel/debug/zram/zram0/block_state". The output is as follows:: - 300 75.033841 .wh. - 301 63.806904 s... - 302 63.806919 ..hi + 300 75.033841 .wh.. + 301 63.806904 s.... + 302 63.806919 ..hi. + 303 62.801919 ....r First column zram's block index. @@ -485,6 +486,8 @@ Third column huge page i: idle page + r: + recompressed page (secondary compression algorithm) First line of above example says 300th block is accessed at 75.033841sec and the block's state is huge so it is written back to the backing diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c index 1e9561217466..5d760467e0bc 100644 --- a/drivers/block/zram/zram_drv.c +++ b/drivers/block/zram/zram_drv.c @@ -925,13 +925,14 @@ static ssize_t read_block_state(struct file *file, char __user *buf, ts = ktime_to_timespec64(zram->table[index].ac_time); copied = snprintf(kbuf + written, count, - "%12zd %12lld.%06lu %c%c%c%c\n", + "%12zd %12lld.%06lu %c%c%c%c%c\n", index, (s64)ts.tv_sec, ts.tv_nsec / NSEC_PER_USEC, zram_test_flag(zram, index, ZRAM_SAME) ? 's' : '.', zram_test_flag(zram, index, ZRAM_WB) ? 'w' : '.', zram_test_flag(zram, index, ZRAM_HUGE) ? 'h' : '.', - zram_test_flag(zram, index, ZRAM_IDLE) ? 'i' : '.'); + zram_test_flag(zram, index, ZRAM_IDLE) ? 'i' : '.', + zram_test_flag(zram, index, ZRAM_RECOMP) ? 'r' : '.'); if (count <= copied) { zram_slot_unlock(zram, index); -- 2.38.0.413.g74048e4d9e-goog