From patchwork Sun Jul 25 01:19:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhaoyang Huang X-Patchwork-Id: 12397875 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=-12.8 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 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 76309C4338F for ; Sun, 25 Jul 2021 01:19:35 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id F3B1760E78 for ; Sun, 25 Jul 2021 01:19:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org F3B1760E78 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 3EB886B0033; Sat, 24 Jul 2021 21:19:34 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3A51E6B005D; Sat, 24 Jul 2021 21:19:34 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 28B086B006C; Sat, 24 Jul 2021 21:19:34 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0137.hostedemail.com [216.40.44.137]) by kanga.kvack.org (Postfix) with ESMTP id 0A3BA6B0033 for ; Sat, 24 Jul 2021 21:19:34 -0400 (EDT) Received: from smtpin16.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id A3B638249980 for ; Sun, 25 Jul 2021 01:19:33 +0000 (UTC) X-FDA: 78399352626.16.0CA3259 Received: from mail-qt1-f174.google.com (mail-qt1-f174.google.com [209.85.160.174]) by imf13.hostedemail.com (Postfix) with ESMTP id 5ABC31014D84 for ; Sun, 25 Jul 2021 01:19:33 +0000 (UTC) Received: by mail-qt1-f174.google.com with SMTP id h10so4484674qth.5 for ; Sat, 24 Jul 2021 18:19:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=oNvp3EMT776UNg0e/cq8UZr4kbEn0tuaztssW5/QDiM=; b=MTR7om8AmG/nZyqR7FnqFZ1mA7uDwv0FmQFUi7bS2UM/FjDhLJpQmJp6la1+LQWopS XZUQB6iGmLbY1eLfzOAqkW+LA8tpt2PnB8hUE/uuKQphfjmGmWgBNkBtHGtb0UlmVdbB /dAn5NCZitt4ArwVxCFnrYtVbD1y8hPfWp1OjDTlN63e0ZOrtf724CWfwHt1CfO8BbwO JlPloAeKqkCtLNiKkmzQ+itC+mO8WaNWc9xISRoxorIOzaTq2c1pl7OwGtbZhDD6bY/J ULmWucfp/HGhbZOHH4f808QjBaWq+m7x7pQyxlIRGnpdYVNSbXD37RwAXGyaXbE/Ho68 6bcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=oNvp3EMT776UNg0e/cq8UZr4kbEn0tuaztssW5/QDiM=; b=sY4Zx9xJ507ptToxLEIe6KCo/IIs5Rebqr8r2Vfoko66kbrRsOfEiTbWn0f1/K+y/b VABzzy0hxPys8mUDaJGWYn/Lv9HFVPba641YcGm1N6TqCwATy6ptJeVnfxlp911GC3VS GWUPDXl1jWpxiAt7yhzT0PZhSO8tQszAlJSNl1wlYkj82h5Rtci2D9uyDKsKqRVUSALH gVY68nShJxgtFp3U71f4FzDBQJYLM37ZdpzOJO8qVZOGHWnT/LInKbbZO+qdY8Ptnaup sFhutWkxM0FQeN/aJ3WMFCkrzrA35ENRDMCh2iNzhLqYIyVfRLHm3EkneuF46rg3TQDl zYyQ== X-Gm-Message-State: AOAM532LbP1u4MzcFdNYOnsQYlUxrZE+EA+BXMlmbGdH6eEHmiwXJ2mj erjFdn2biJL5AyzCj5s1XDThpqSoAreTJv/msoQ= X-Google-Smtp-Source: ABdhPJyzUw1jc+bdHbLl3Qmnt+mBanCkJWiWDVbw6rmjVWeaEosvP76i1vBUIzbCkC7A5i2/02TQa1d2HHFRZecVZ/s= X-Received: by 2002:ac8:43ca:: with SMTP id w10mr9765436qtn.286.1627175972758; Sat, 24 Jul 2021 18:19:32 -0700 (PDT) MIME-Version: 1.0 References: <1626763658-27748-1-git-send-email-huangzhaoyang@gmail.com> In-Reply-To: <1626763658-27748-1-git-send-email-huangzhaoyang@gmail.com> From: Zhaoyang Huang Date: Sun, 25 Jul 2021 09:19:06 +0800 Message-ID: Subject: [Resend PATCH] driver: zram: fix wrong counting on pages_store To: Minchan Kim , Zhaoyang Huang , "open list:MEMORY MANAGEMENT" , LKML , Nitin Gupta , Sergey Senozhatsky X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 5ABC31014D84 Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=MTR7om8A; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf13.hostedemail.com: domain of huangzhaoyang@gmail.com designates 209.85.160.174 as permitted sender) smtp.mailfrom=huangzhaoyang@gmail.com X-Stat-Signature: qiyndahwr75ozw81pu4p4cndggm4onp1 X-HE-Tag: 1627175973-78471 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: 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 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);