From 975fccdb833f7e72566cc8cf3951113133319217 Mon Sep 17 00:00:00 2001 From: Konrad Kuchciak Date: Fri, 1 Feb 2019 13:13:37 +0100 Subject: [PATCH] swap: FIX Do not setup swap after resourced restart Change-Id: I1aa3bdf1ab5b2781238b3830389dccf7599e081a Signed-off-by: Konrad Kuchciak --- src/swap/swap.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/swap/swap.c b/src/swap/swap.c index 315cc1a..0418686 100644 --- a/src/swap/swap.c +++ b/src/swap/swap.c @@ -1014,11 +1014,6 @@ static int swap_init(void) if (!arg_swap_enable) return -ENODEV; - if (resourced_restarted()) { - _I("Assuming swap is already set up. To reconfigure, reboot the device."); - return 0; - } - gslist_for_each_safe(swap_module, iter, next, swaps) { swaps = (struct swap_module_ops *)iter->data; if (!CHECK_BIT(arg_swap_type, swaps->type)) { @@ -1157,9 +1152,14 @@ static int resourced_swap_init(void *data) if (ret != RESOURCED_ERROR_NONE) return ret; + if (!resourced_restarted()) { + register_notifier(RESOURCED_NOTIFIER_BOOTING_DONE, swap_activate_handler); + } else { + _I("Assuming swap is already set up. To reconfigure, reboot the device."); + } + register_notifier(RESOURCED_NOTIFIER_SWAP_START, swap_start_handler); register_notifier(RESOURCED_NOTIFIER_SWAP_ACTIVATE, swap_activate_handler); - register_notifier(RESOURCED_NOTIFIER_BOOTING_DONE, swap_activate_handler); register_notifier(RESOURCED_NOTIFIER_SWAP_COMPACT, swap_compact_handler); register_notifier(RESOURCED_NOTIFIER_SWAP_UNSET_LIMIT, swap_cgroup_reset_limit); -- 2.7.4