Re: [PATCH v5] zram: Introduce an aged idle interface

From: Andrew Morton
Date: Fri Sep 24 2021 - 15:54:28 EST


On Fri, 24 Sep 2021 09:11:28 -0700 Brian Geffon <bgeffon@xxxxxxxxxx> wrote:

> This change introduces an aged idle interface to the existing
> idle sysfs file for zram.
>
> When CONFIG_ZRAM_MEMORY_TRACKING is enabled the idle file
> now also accepts an integer argument. This integer is the
> age (in seconds) of pages to mark as idle. The idle file
> still supports 'all' as it always has. This new approach
> allows for much more control over which pages get marked
> as idle.
>
> v4 -> v5:
> - Andrew's suggestions to use IS_ENABLED and
> cleanup comment.

Also this?

--- a/drivers/block/zram/zram_drv.c~zram-introduce-an-aged-idle-interface-v5-fix
+++ a/drivers/block/zram/zram_drv.c
@@ -309,9 +309,8 @@ static void mark_idle(struct zram *zram,
zram_slot_lock(zram, index);
if (zram_allocated(zram, index) &&
!zram_test_flag(zram, index, ZRAM_UNDER_WB)) {
-#ifdef CONFIG_ZRAM_MEMORY_TRACKING
+ if (IS_ENABLED(CONFIG_ZRAM_MEMORY_TRACKING))
is_idle = (!cutoff || ktime_after(cutoff, zram->table[index].ac_time));
-#endif
if (is_idle)
zram_set_flag(zram, index, ZRAM_IDLE);
}
_