* + zram-clear-idle-flag-after-recompression.patch added to mm-unstable branch
@ 2024-10-28 22:10 Andrew Morton
2024-10-29 8:07 ` Sergey Senozhatsky
0 siblings, 1 reply; 3+ messages in thread
From: Andrew Morton @ 2024-10-28 22:10 UTC (permalink / raw)
To: mm-commits, minchan, kawasin, senozhatsky, akpm
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@chromium.org>
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@chromium.org
Link: https://lkml.kernel.org/r/20241028073529.1383980-2-senozhatsky@chromium.org
Signed-off-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Reported-by: Shin Kawamura <kawasin@google.com>
Cc: Minchan Kim <minchan@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
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: + zram-clear-idle-flag-after-recompression.patch added to mm-unstable branch
2024-10-28 22:10 + zram-clear-idle-flag-after-recompression.patch added to mm-unstable branch Andrew Morton
@ 2024-10-29 8:07 ` Sergey Senozhatsky
0 siblings, 0 replies; 3+ messages in thread
From: Sergey Senozhatsky @ 2024-10-29 8:07 UTC (permalink / raw)
To: Andrew Morton; +Cc: mm-commits, minchan, kawasin, senozhatsky
On (24/10/28 15:10), Andrew Morton wrote:
> 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@chromium.org
> Link: https://lkml.kernel.org/r/20241028073529.1383980-2-senozhatsky@chromium.org
> Signed-off-by: Sergey Senozhatsky <senozhatsky@chromium.org>
> Reported-by: Shin Kawamura <kawasin@google.com>
> Cc: Minchan Kim <minchan@kernel.org>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Andrew, can I please ask you to replace these patches with v2 series?
v2 comes with styles and typos fixed.
https://lore.kernel.org/linux-kernel/20241028153629.1479791-1-senozhatsky@chromium.org
^ permalink raw reply [flat|nested] 3+ messages in thread
* + zram-clear-idle-flag-after-recompression.patch added to mm-unstable branch
@ 2024-10-30 1:04 Andrew Morton
0 siblings, 0 replies; 3+ messages in thread
From: Andrew Morton @ 2024-10-30 1:04 UTC (permalink / raw)
To: mm-commits, minchan, kawasin, bgeffon, senozhatsky, akpm
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@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>
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
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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-10-30 1:04 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-28 22:10 + zram-clear-idle-flag-after-recompression.patch added to mm-unstable branch Andrew Morton
2024-10-29 8:07 ` Sergey Senozhatsky
-- strict thread matches above, loose matches on Subject: below --
2024-10-30 1:04 Andrew Morton
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.