From: Yue Hu <zbestahu@gmail.com>
To: minchan@kernel.org, ngupta@vflare.org, sergey.senozhatsky.work@gmail.com
Cc: linux-kernel@vger.kernel.org, huyue2@yulong.com
Subject: [PATCH] zram: do not set ZRAM_IDLE bit for idlepage writeback in writeback_store()
Date: Tue, 21 Jan 2020 19:35:57 +0800 [thread overview]
Message-ID: <20200121113557.11608-1-zbestahu@gmail.com> (raw)
From: Yue Hu <huyue2@yulong.com>
Currently, we will call zram_set_flag() to set ZRAM_IDLE bit even for
idlepage writeback. That is pointless. Let's set it only for hugepage mode.
Signed-off-by: Yue Hu <huyue2@yulong.com>
---
drivers/block/zram/zram_drv.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index 4285e75..eef5767 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -689,16 +689,18 @@ static ssize_t writeback_store(struct device *dev,
if (mode == IDLE_WRITEBACK &&
!zram_test_flag(zram, index, ZRAM_IDLE))
goto next;
- if (mode == HUGE_WRITEBACK &&
- !zram_test_flag(zram, index, ZRAM_HUGE))
- goto next;
+ if (mode == HUGE_WRITEBACK) {
+ if (!zram_test_flag(zram, index, ZRAM_HUGE))
+ goto next;
+ /* Need for hugepage writeback racing */
+ zram_set_flag(zram, index, ZRAM_IDLE);
+ }
+
/*
* Clearing ZRAM_UNDER_WB is duty of caller.
* IOW, zram_free_page never clear it.
*/
zram_set_flag(zram, index, ZRAM_UNDER_WB);
- /* Need for hugepage writeback racing */
- zram_set_flag(zram, index, ZRAM_IDLE);
zram_slot_unlock(zram, index);
if (zram_bvec_read(zram, &bvec, index, 0, NULL)) {
zram_slot_lock(zram, index);
--
1.9.1
next reply other threads:[~2020-01-21 11:36 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-21 11:35 Yue Hu [this message]
2020-01-23 2:23 ` [PATCH] zram: do not set ZRAM_IDLE bit for idlepage writeback in writeback_store() Minchan Kim
2020-01-23 2:39 ` Yue Hu
2020-01-23 23:25 ` Minchan Kim
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200121113557.11608-1-zbestahu@gmail.com \
--to=zbestahu@gmail.com \
--cc=huyue2@yulong.com \
--cc=linux-kernel@vger.kernel.org \
--cc=minchan@kernel.org \
--cc=ngupta@vflare.org \
--cc=sergey.senozhatsky.work@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).