The patch titled Subject: zram: clear IDLE flag after recompression has been added to the -mm mm-unstable branch. Its filename is zram-clear-idle-flag-after-recompression.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/zram-clear-idle-flag-after-recompression.patch This patch will later appear in the mm-unstable branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via the mm-everything branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there every 2-3 working days ------------------------------------------------------ From: Sergey Senozhatsky <senozhatsky@xxxxxxxxxxxx> Subject: zram: clear IDLE flag after recompression Date: Mon, 28 Oct 2024 16:34:57 +0900 Patch series "zram: IDLE flag handling fixes". 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 entires 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. Link: https://lkml.kernel.org/r/20241028073529.1383980-1-senozhatsky@xxxxxxxxxxxx Link: https://lkml.kernel.org/r/20241028073529.1383980-2-senozhatsky@xxxxxxxxxxxx Signed-off-by: Sergey Senozhatsky <senozhatsky@xxxxxxxxxxxx> Reported-by: Shin Kawamura <kawasin@xxxxxxxxxx> Cc: Minchan Kim <minchan@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- drivers/block/zram/zram_drv.c | 7 +++++++ 1 file changed, 7 insertions(+) --- a/drivers/block/zram/zram_drv.c~zram-clear-idle-flag-after-recompression +++ a/drivers/block/zram/zram_drv.c @@ -1864,6 +1864,13 @@ static int recompress_slot(struct zram * if (ret) return ret; + /* + * We touched this entry so mark it as non-IDLE. This makes sure that + * we don't preserve IDLE flag and don't incorrectly pick this entry + * for different post-processing type (e.g. writeback). + */ + zram_clear_flag(zram, index, ZRAM_IDLE); + class_index_old = zs_lookup_class_index(zram->mem_pool, comp_len_old); /* * Iterate the secondary comp algorithms list (in order of priority) _ Patches currently in -mm which might be from senozhatsky@xxxxxxxxxxxx are zram-introduce-zram_pp_slot-flag.patch zram-permit-only-one-post-processing-operation-at-a-time.patch zram-rework-recompress-target-selection-strategy.patch zram-rework-recompress-target-selection-strategy-fix.patch zram-rework-writeback-target-selection-strategy.patch zram-do-not-mark-idle-slots-that-cannot-be-idle.patch zram-reshuffle-zram_free_page-flags-operations.patch zram-remove-under_wb-and-simplify-writeback.patch zram-do-not-open-code-comp-priority-0.patch zram-clear-idle-flag-after-recompression.patch zram-clear-idle-flag-in-mark_idle.patch