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 D63B7C4332F for ; Wed, 9 Nov 2022 11:51:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229575AbiKILv0 (ORCPT ); Wed, 9 Nov 2022 06:51:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34532 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230381AbiKILvK (ORCPT ); Wed, 9 Nov 2022 06:51:10 -0500 Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 196612ED4A for ; Wed, 9 Nov 2022 03:51:08 -0800 (PST) Received: by mail-pj1-x1030.google.com with SMTP id l22-20020a17090a3f1600b00212fbbcfb78so1594641pjc.3 for ; Wed, 09 Nov 2022 03:51:08 -0800 (PST) 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=CxgUv5Jq0W8ZFLhbjb9RaEmetBmdXcouEW/1Ze+ngG4=; b=hv/tWsa79zDploMiCRfP2WLvQCUm6/oR3RjNrpKYsUVMrG2aG4DHN667JQcPpo0Xd5 oW4yapOp9W+yIMxkRkbFUEHfQKYMTDId71N/E0NS1bLMEaWFLJmV1rKZ6K0enEDy3NzR d6ZjFjGXP38VU3BuVVaL+nxLbjBqyBONMDet4= 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=CxgUv5Jq0W8ZFLhbjb9RaEmetBmdXcouEW/1Ze+ngG4=; b=7C6ScQD2nSUA92guxqpNyJdfCBkXg86txp6xyIaHPtuZRYAb9wQlUSPx0EgU5uVxyX vCUsr4Crsf/kY478BQWiJxrqPKhWSkpR/2r2oUd4X0QcB3dYS24x3iEdPhAZIYpLUmIt XCxqc3I3B3bqGrfz6o5grQ/BAZIm2jdGApyVW/nzK7axQRD/jrkMvA8Bd10+ZtXgEGt/ SG/EU+E2nxMCJpZTuyD8olMInUKVWRoDulEkUVUfh5IhICtUmPHnLsQcnIOE+r9b7B6u ns3Is9+qcHBCZ5KOymM7wVyJPSY3OEzY+qh4FBXhciJZERSuAbxhr3intwd27eUi13Xz leWQ== X-Gm-Message-State: ANoB5pkLPVcbbJsTLQvQk3vp5b0sJwB+W32+wGrbgf/MRmV8BUoNlCb6 0m1frhMKCyxM5cO9HJyT5yL84w== X-Google-Smtp-Source: AA0mqf4tBVBjmJv7avLtutcZSy3HULQ3lJ8Pc/mYPVodPYE5ju4Xo3CDRE/ta5HYDn3SR+WNZbg5ig== X-Received: by 2002:a17:902:6aca:b0:188:736c:befa with SMTP id i10-20020a1709026aca00b00188736cbefamr764365plt.8.1667994667622; Wed, 09 Nov 2022 03:51:07 -0800 (PST) Received: from tigerii.tok.corp.google.com ([2401:fa00:8f:203:61f1:44d3:3f47:2cdb]) by smtp.gmail.com with ESMTPSA id f5-20020a655505000000b00434760ee36asm7292311pgr.16.2022.11.09.03.51.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Nov 2022 03:51:07 -0800 (PST) From: Sergey Senozhatsky To: Minchan Kim , Andrew Morton Cc: Nitin Gupta , Suleiman Souhlal , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Sergey Senozhatsky Subject: [PATCHv5 05/13] zram: Add recompress flag to read_block_state() Date: Wed, 9 Nov 2022 20:50:39 +0900 Message-Id: <20221109115047.2921851-6-senozhatsky@chromium.org> X-Mailer: git-send-email 2.38.1.431.g37b22c650d-goog In-Reply-To: <20221109115047.2921851-1-senozhatsky@chromium.org> References: <20221109115047.2921851-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 c73b16930449..177a142c3146 100644 --- a/Documentation/admin-guide/blockdev/zram.rst +++ b/Documentation/admin-guide/blockdev/zram.rst @@ -411,9 +411,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. @@ -430,6 +431,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 749e4266dd72..560e2932021e 100644 --- a/drivers/block/zram/zram_drv.c +++ b/drivers/block/zram/zram_drv.c @@ -939,13 +939,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_get_priority(zram, index) ? 'r' : '.'); if (count <= copied) { zram_slot_unlock(zram, index); -- 2.38.1.431.g37b22c650d-goog