From patchwork Wed Dec 1 10:59:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhaoyang Huang X-Patchwork-Id: 12649733 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4383EC433F5 for ; Wed, 1 Dec 2021 10:59:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 723996B0073; Wed, 1 Dec 2021 05:59:31 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 6D28E6B0074; Wed, 1 Dec 2021 05:59:31 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 59A0F6B0075; Wed, 1 Dec 2021 05:59:31 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0227.hostedemail.com [216.40.44.227]) by kanga.kvack.org (Postfix) with ESMTP id 46EC86B0073 for ; Wed, 1 Dec 2021 05:59:31 -0500 (EST) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id F4126180E1E57 for ; Wed, 1 Dec 2021 10:59:20 +0000 (UTC) X-FDA: 78868928880.15.939DB4D Received: from mail-pf1-f172.google.com (mail-pf1-f172.google.com [209.85.210.172]) by imf27.hostedemail.com (Postfix) with ESMTP id 9CE707000081 for ; Wed, 1 Dec 2021 10:59:20 +0000 (UTC) Received: by mail-pf1-f172.google.com with SMTP id g19so23989629pfb.8 for ; Wed, 01 Dec 2021 02:59:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:date:message-id; bh=PWWyFFsXpRHL6hxAvW+NFHh+TToRHVZ/QnnfoR4yX7Y=; b=G3g/vip680CBXv7uoowdy92Zk/ZRXIxOKbusZfJlY0Lr0H6uoOuoFNSzRsGEbW3Qyb Ob3ghc317EoCUFP6ja+KR+BnlX+BR8w5/DocPHiG7FcSJ3Xr3+7yTqqyky6wpqaXkESV eF1xleAl0DY+cwttLG1wk2dXBUWeTprLjJEi81YefIeuX8EHeZQl0WDYzy1KxexIWh0h Ie2pDd0UUL4LKSMN5bHKLz50JMCrcnrWQzaz0+vXIhEk6G3fWbGf7CfG4G7vMP9zAoRo nN9YCmxzDf00Mpe2tbp9OUMbpSVS5g0QmC3DYoBjAgYnrJkO7Bw1sh5Yvnf5WOMN5D8D 3XdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id; bh=PWWyFFsXpRHL6hxAvW+NFHh+TToRHVZ/QnnfoR4yX7Y=; b=OMqrYt5jeEn5/SEKr+Ew23rd6PGywuKEIsrKvHqS24kAxlAwVcDkyZr+l5tLl4secZ rtHKC831Nrli8p2SCYZaxk6Tc44XXTk9WsY1ndsw5Ciz+IVfNN7xiswjWPXg4gt0ikrj 06TT3L9GloETK7vsvhdIoTGAu7H52rlfkZwbIjT3bjPL4lV51HfkkBA9w78H651KFUfN FQcGHaFTne8BVRCl+2aBgLu6rF68jpw53cBkx2ws8rqnQTxI+DUyWPAglTFD8K22BRmP 3ItgL6gOkHR4SFHufuj51nxbq2SwjpZT33pD5Gm/vjL0NxKr8kJlwsp5Dfpq8vaWz+q0 ++oA== X-Gm-Message-State: AOAM532R4A/W7ydHpM5/JiTaqoP9ISnBPkbpESyhsR36f4WNvrPbQX6y yyGRNS5VIiVTYheWe+dbTYk= X-Google-Smtp-Source: ABdhPJycByYgRyQPvyF+HqSlbW4PQRf4zj4GyW40yHsyBwAa9hkBJnozSSKe1uJ6Yl7lJZEzRWns7g== X-Received: by 2002:a63:5416:: with SMTP id i22mr4158240pgb.382.1638356359631; Wed, 01 Dec 2021 02:59:19 -0800 (PST) Received: from bj03382pcu.spreadtrum.com ([117.18.48.102]) by smtp.gmail.com with ESMTPSA id i185sm23871074pfg.80.2021.12.01.02.59.16 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 01 Dec 2021 02:59:19 -0800 (PST) From: Huangzhaoyang To: Nitin Gupta , Sergey Senozhatsky , Jens Axboe , Johannes Weiner , Minchan Kim , Zhaoyang Huang , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH] mm: count zram read/write into PSI_IO_WAIT Date: Wed, 1 Dec 2021 18:59:01 +0800 Message-Id: <1638356341-17014-1-git-send-email-huangzhaoyang@gmail.com> X-Mailer: git-send-email 1.7.9.5 X-Stat-Signature: hotommzz96whmxgas6kf9n6fsitk4ra8 Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b="G3g/vip6"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf27.hostedemail.com: domain of huangzhaoyang@gmail.com designates 209.85.210.172 as permitted sender) smtp.mailfrom=huangzhaoyang@gmail.com X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 9CE707000081 X-HE-Tag: 1638356360-567988 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 Have zram reading/writing be counted in PSI_IO_WAIT. Signed-off-by: Zhaoyang Huang --- drivers/block/zram/zram_drv.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c index fcaf275..b0e4766 100644 --- a/drivers/block/zram/zram_drv.c +++ b/drivers/block/zram/zram_drv.c @@ -34,6 +34,7 @@ #include #include #include +#include #include "zram_drv.h" @@ -1246,7 +1247,9 @@ static int __zram_bvec_read(struct zram *zram, struct page *page, u32 index, zram_get_element(zram, index), bio, partial_io); } - +#ifdef CONFIG_PSI + psi_task_change(current, 0, TSK_IOWAIT); +#endif handle = zram_get_handle(zram, index); if (!handle || zram_test_flag(zram, index, ZRAM_SAME)) { unsigned long value; @@ -1257,6 +1260,9 @@ static int __zram_bvec_read(struct zram *zram, struct page *page, u32 index, zram_fill_page(mem, PAGE_SIZE, value); kunmap_atomic(mem); zram_slot_unlock(zram, index); +#ifdef CONFIG_PSI + psi_task_change(current, TSK_IOWAIT, 0); +#endif return 0; } @@ -1284,6 +1290,9 @@ static int __zram_bvec_read(struct zram *zram, struct page *page, u32 index, if (WARN_ON(ret)) pr_err("Decompression failed! err=%d, page=%u\n", ret, index); +#ifdef CONFIG_PSI + psi_task_change(current, TSK_IOWAIT, 0); +#endif return ret; } @@ -1471,7 +1480,13 @@ static int zram_bvec_write(struct zram *zram, struct bio_vec *bvec, vec.bv_offset = 0; } +#ifdef CONFIG_PSI + psi_task_change(current, 0, TSK_IOWAIT); +#endif ret = __zram_bvec_write(zram, &vec, index, bio); +#ifdef CONFIG_PSI + psi_task_change(current, TSK_IOWAIT, 0); +#endif out: if (is_partial_io(bvec)) __free_page(page); @@ -1607,7 +1622,6 @@ static blk_qc_t zram_submit_bio(struct bio *bio) atomic64_inc(&zram->stats.invalid_io); goto error; } - __zram_make_request(zram, bio); return BLK_QC_T_NONE;