Skip to content

Commit d37da42

Browse files
sergey-senozhatskyakpm00
authored andcommitted
zram: clear IDLE flag in mark_idle()
If entry does not fulfill current mark_idle() parameters, e.g. cutoff time, then we should clear its ZRAM_IDLE from previous mark_idle() invocations. Consider the following case: - mark_idle() cutoff time 8h - mark_idle() cutoff time 4h - writeback() idle - will writeback entries with cutoff time 8h, while it should only pick entries with cutoff time 4h The bug was reported by Shin Kawamura. Link: https://lkml.kernel.org/r/[email protected] Fixes: 755804d ("zram: introduce an aged idle interface") Signed-off-by: Sergey Senozhatsky <[email protected]> Reported-by: Shin Kawamura <[email protected]> Acked-by: Brian Geffon <[email protected]> Cc: Minchan Kim <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Cc: <[email protected]>
1 parent f852190 commit d37da42

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/block/zram/zram_drv.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,8 @@ static void mark_idle(struct zram *zram, ktime_t cutoff)
410410
#endif
411411
if (is_idle)
412412
zram_set_flag(zram, index, ZRAM_IDLE);
413+
else
414+
zram_clear_flag(zram, index, ZRAM_IDLE);
413415
zram_slot_unlock(zram, index);
414416
}
415417
}

0 commit comments

Comments
 (0)