Android zram writeback
commit message:
"Create a Zram writeback job
Zram on some devices can support writing idle pages on to disk. ZramWriteback schedules jobs to track idle pages and trigger write-to-disk when the device is idle."
the functionality is based on idle page writeback support, and requires CONFIG_ZRAM_WRITEBACK=y in kernel config. losetup can be used to create loop device from swapfile, so backing_dev could be assigned to.
it also requires config_zramWriteback to be set enabled.
the commit introduced three properties (default value from pixel). ro.zram.mark_idle_delay_mins = 60 ro.zram.first_wb_delay_mins = 1440 ro.zram.periodic_wb_delay_hours = 24
so it works like: add timer do (run every periodic_wb_delay_hours * 60 then fork run) sleep(first_wb_delay_mins) :run write all to zram devices(mark as idle) sleep(mark_idle_delay_mins) start writeback
ref: https://www.kernel.org/doc/html/latest/admin-guide/blockdev/zram.html services/core/java/com/android/server/ZramWriteback.java from android platform/frameworks/base