lkml.org 
[lkml]   [2021]   [Sep]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH v5] zram: Introduce an aged idle interface
> 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);
> }
> _
>

Hi Andrew,
As written that patch won't compile when
CONFIG_ZRAM_MEMORY_TRACKING=n, my guess is that the compiler pass that
removes the dead branch only happens after it attempts to compile the
branch itself. So it appears that even though IS_ENABLED(..) always
evaluates to 0, the compile will fail because table[index].ac_time
does not exist. You should get an error like this:

drivers/block/zram/zram_drv.c:314:57: error: no member named 'ac_time'
in 'struct zram_table_entry'
(!cutoff
|| ktime_after(cutoff, zram->table[index].ac_time)))

Brian

\
 
 \ /
  Last update: 2021-09-24 22:17    [W:0.060 / U:0.460 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site