From: Konrad Kuchciak Date: Fri, 1 Feb 2019 12:13:37 +0000 (+0100) Subject: swap: FIX Do not setup swap after resourced restart X-Git-Tag: accepted/tizen/unified/20190213.071904^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=975fccdb833f7e72566cc8cf3951113133319217;p=platform%2Fcore%2Fsystem%2Fresourced.git swap: FIX Do not setup swap after resourced restart Change-Id: I1aa3bdf1ab5b2781238b3830389dccf7599e081a Signed-off-by: Konrad Kuchciak --- 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);