From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4BB38C4332F for ; Tue, 18 Oct 2022 04:56:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230121AbiJRE4u (ORCPT ); Tue, 18 Oct 2022 00:56:50 -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-Google-Smtp-Source: AMsMyM4FOU2/bLgIX42hGV0iONzrzomt7CCu65KWnilogKYyQZoRpCn/IH6cUR0nYi3r5vr3skYaXQ== 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 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