]> www.infradead.org Git - users/jedix/linux-maple.git/commit
zram: clear IDLE flag after recompression
authorSergey Senozhatsky <senozhatsky@chromium.org>
Mon, 28 Oct 2024 15:36:14 +0000 (00:36 +0900)
committerAndrew Morton <akpm@linux-foundation.org>
Fri, 1 Nov 2024 04:29:34 +0000 (21:29 -0700)
commit1284b75d1ec44176f8ee15d11b621cbbf5614d22
tree2231221fa5dd5149f44ec7502b7e8d9985f22948
parente57c5bfea8b2c18e3ffbbcaa59d91f13301bf14a
zram: clear IDLE flag after recompression

Patch series "zram: IDLE flag handling fixes", v2.

zram can wrongly preserve ZRAM_IDLE flag on its entries which can result
in premature post-processing (writeback and recompression) of such
entries.

This patch (of 2)

Recompression should clear ZRAM_IDLE flag on the entries it has accessed,
because otherwise some entries, specifically those for which recompression
has failed, become immediate candidate entries for another post-processing
(e.g.  writeback).

Consider the following case:
- recompression marks entries IDLE every 4 hours and attempts
  to recompress them
- some entries are incompressible, so we keep them intact and
  hence preserve IDLE flag
- writeback marks entries IDLE every 8 hours and writebacks
  IDLE entries, however we have IDLE entries left from
  recompression, so writeback prematurely writebacks those
  entries.

The bug was reported by Shin Kawamura.

Link: https://lkml.kernel.org/r/20241028153629.1479791-1-senozhatsky@chromium.org
Link: https://lkml.kernel.org/r/20241028153629.1479791-2-senozhatsky@chromium.org
Fixes: 84b33bf78889 ("zram: introduce recompress sysfs knob")
Signed-off-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Reported-by: Shin Kawamura <kawasin@google.com>
Acked-by: Brian Geffon <bgeffon@google.com>
Cc: Minchan Kim <minchan@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
drivers/block/zram/zram_drv.c