From patchwork Tue Jul 20 06:47:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhaoyang Huang X-Patchwork-Id: 12387627 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 73478C636C8 for ; Tue, 20 Jul 2021 06:48:11 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id DE3DE6113B for ; Tue, 20 Jul 2021 06:48:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DE3DE6113B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 874B16B0093; Tue, 20 Jul 2021 02:48:11 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7FE626B00DA; Tue, 20 Jul 2021 02:48:11 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 676DC8D0001; Tue, 20 Jul 2021 02:48:11 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0254.hostedemail.com [216.40.44.254]) by kanga.kvack.org (Postfix) with ESMTP id 3CE556B0093 for ; Tue, 20 Jul 2021 02:48:11 -0400 (EDT) Received: from smtpin37.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id BA1DF267EA for ; Tue, 20 Jul 2021 06:48:09 +0000 (UTC) X-FDA: 78382036698.37.7D114C7 Received: from mail-pg1-f182.google.com (mail-pg1-f182.google.com [209.85.215.182]) by imf07.hostedemail.com (Postfix) with ESMTP id 7B8ED100AC13 for ; Tue, 20 Jul 2021 06:48:09 +0000 (UTC) Received: by mail-pg1-f182.google.com with SMTP id k20so21639439pgg.7 for ; Mon, 19 Jul 2021 23:48:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id; bh=s1uZNvfYU0GpljT1GvWNKfoOHLQiAyxeoEdgPFxn/sU=; b=YP2gSP4GeBIWZ2DD34PTJuchrpSXDkpXWx8eZFMBXUAFdS8BMX3kkyu4jubuFOuFsf yxXN0ibtl0SF5goswfSSyJhYdJK1PWUBm0zjSj8dgcacafV7TAsKztEetZTFbLVwHUpp Df5yjMJ2iQlqkW6JDiPOLMUb3lkILU91h6ruLWu+1D82eQP+3CxQSmdkjEHjUPm+MTrk mg7zUFvjqrqFO+TgcaWoAkuyEe+fjDSQkDkJ3lAGNxCP/PMQWHIxZvPVw10zMcDfR8CC 8jeMG2QHrPycx9bw6bqmim5i74rSJCyqUadFT/dSQO+qTSCW4nbJDodjs6ScOR7yhgp3 4sug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=s1uZNvfYU0GpljT1GvWNKfoOHLQiAyxeoEdgPFxn/sU=; b=pQtuirNxj+MJb3sgrjzUkS/fWczH9rPbgIgiIM7+Rz4MJdNXLH9ieb81IGNTayHk7b Vdi6+dM9PTD6sSQPWBZVL1uokwKVtGT6p4RHOuFg8GcuylveFDp6ArmCZPoaVchZzJDh o4TUo2KklUrrV7yRQ7zVtdEkjiyMRRKVA+oplXcTRh4xAj9IQLosqec8+moqPfI3Kyjf hq2VkJ6VePn/XchxMcAnflKznIkS5sQ9XJVEeiK7XzOA6btNdyjQH24nJUPRgWHcXKdm +IA+3jRUVyX7h3xMkjqHcYhM7AU8BVGjjlJitxErxrXyxIEs4y6JsnoHOvz/aHT+1w53 UvnA== X-Gm-Message-State: AOAM53165BTmf0P8kv3+jDKCjstXD1IEIpWRERZmK00ksGoFQEu/czlh x/lKbpvZFTGGMi/4TykVyg8= X-Google-Smtp-Source: ABdhPJx8w9gFLgZZuYbzwzjexB4rjChaujMR3kJT2/1cdIcVHid5J3ryWhB8zAlRnhlkteIr7gdT+A== X-Received: by 2002:a63:4726:: with SMTP id u38mr28781872pga.275.1626763688503; Mon, 19 Jul 2021 23:48:08 -0700 (PDT) Received: from bj03382pcu.spreadtrum.com ([117.18.48.102]) by smtp.gmail.com with ESMTPSA id s7sm21379039pfk.12.2021.07.19.23.48.03 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 Jul 2021 23:48:08 -0700 (PDT) From: Huangzhaoyang To: Minchan Kim , Zhaoyang Huang , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Nitin Gupta , Sergey Senozhatsky Subject: [PATCH] driver: zram: fix wrong counting on pages_store Date: Tue, 20 Jul 2021 14:47:38 +0800 Message-Id: <1626763658-27748-1-git-send-email-huangzhaoyang@gmail.com> X-Mailer: git-send-email 1.7.9.5 X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 7B8ED100AC13 X-Stat-Signature: acq5yiak1y9wjaqdpqf7pw9wya11uod6 Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=YP2gSP4G; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf07.hostedemail.com: domain of huangzhaoyang@gmail.com designates 209.85.215.182 as permitted sender) smtp.mailfrom=huangzhaoyang@gmail.com X-HE-Tag: 1626763689-298240 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: From: Zhaoyang Huang It makes the statistic confused when counting pages_store in during writeback. pages_store should just reflect the swapped pages on ZRAM, while bd_writes be responsible for writeback things. Signed-off-by: Zhaoyang Huang --- drivers/block/zram/zram_drv.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c index cf8deec..6bdaa9d 100644 --- a/drivers/block/zram/zram_drv.c +++ b/drivers/block/zram/zram_drv.c @@ -765,7 +765,6 @@ static ssize_t writeback_store(struct device *dev, zram_set_flag(zram, index, ZRAM_WB); zram_set_element(zram, index, blk_idx); blk_idx = 0; - atomic64_inc(&zram->stats.pages_stored); spin_lock(&zram->wb_limit_lock); if (zram->wb_limit_enable && zram->bd_wb_limit > 0) zram->bd_wb_limit -= 1UL << (PAGE_SHIFT - 12);