On Mon, Nov 11, 2024 at 8:42 AM Brian Geffon bgeffon@google.com wrote:
On Mon, Nov 11, 2024 at 3:28 AM Andrew Morton akpm@linux-foundation.org wrote:
The quilt patch titled Subject: zram: clear IDLE flag after recompression has been removed from the -mm tree. Its filename was zram-clear-idle-flag-after-recompression.patch
This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
From: Sergey Senozhatsky senozhatsky@chromium.org Subject: zram: clear IDLE flag after recompression Date: Tue, 29 Oct 2024 00:36:14 +0900
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
Cc: stable@vger.kernel.org
Signed-off-by: Andrew Morton akpm@linux-foundation.org
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@chromium.org are
On Mon, 11 Nov 2024 08:43:07 -0500 Brian Geffon bgeffon@google.com wrote:
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
Cc: stable@vger.kernel.org
OK, thanks, I edited/rebased.
linux-stable-mirror@lists.linaro.org