Remove useless source code 55/273755/2
authorUnsung Lee <unsung.lee@samsung.com>
Wed, 13 Apr 2022 08:50:58 +0000 (17:50 +0900)
committerUnsung Lee <unsung.lee@samsung.com>
Wed, 13 Apr 2022 09:01:18 +0000 (18:01 +0900)
remove bgreclaim when lcd is turned off

Change-Id: If734d6975b18efeb53242a0e52000c29c4d069d3
Signed-off-by: Unsung Lee <unsung.lee@samsung.com>
src/common/notifier.h
src/process/proc-monitor.c
src/resource-limiter/memory/vmpressure-lowmem-handler.c
tests/cmocka-proc-dbus-typecheck.c

index 416ef26..b52f1f5 100644 (file)
@@ -106,8 +106,6 @@ enum notifier_type {
        RESOURCED_NOTIFIER_POWER_OFF,
        RESOURCED_NOTIFIER_SYSTEMTIME_CHANGED,
        RESOURCED_NOTIFIER_LOW_BATTERY,
-       RESOURCED_NOTIFIER_LCD_ON,
-       RESOURCED_NOTIFIER_LCD_OFF,
        RESOURCED_NOTIFIER_CPU_ON,
        RESOURCED_NOTIFIER_CPU_OFF,
 
index d868742..16e3194 100644 (file)
@@ -825,14 +825,12 @@ static void proc_dbus_systemservice_handler(GVariant *params)
 EXPORT_TEST void proc_dbus_lcd_on(GVariant *params)
 {
        current_lcd_state = LCD_STATE_ON;
-       resourced_notify(RESOURCED_NOTIFIER_LCD_ON, NULL);
        /* nothing */
 }
 
 EXPORT_TEST void proc_dbus_lcd_off(GVariant *params)
 {
        current_lcd_state = LCD_STATE_OFF;
-       resourced_notify(RESOURCED_NOTIFIER_LCD_OFF, NULL);
 }
 
 EXPORT_TEST void booting_done_signal_handler(GVariant *params)
index f755c57..cc1c34f 100644 (file)
@@ -363,7 +363,6 @@ static const struct module_ops *lowmem_ops;
 static bool oom_popup_enable;
 static bool oom_popup;
 static bool memcg_swap_status;
-static bool bg_reclaim;
 static int fragmentation_size;
 
 static const char *convert_cgroup_type_to_str(int type)
@@ -1830,26 +1829,6 @@ int lowmem_control_handler(void *data)
        return RESOURCED_ERROR_NONE;
 }
 
-static int lowmem_bg_reclaim_handler(void *data)
-{
-       if (swap_get_state() != SWAP_ON)
-               return RESOURCED_ERROR_NONE;
-
-       if (!bg_reclaim)
-               return RESOURCED_ERROR_NONE;
-
-       /*
-        * Proactively reclaiming memory used by long-lived background processes
-        * (such as widget instances) may be efficient on devices with limited
-        * memory constraints. The pages used by such processes could be reclaimed
-        * (if swap is enabled) earlier than they used to while minimizing the
-        * impact on the user experience.
-        */
-       resourced_notify(RESOURCED_NOTIFIER_SWAP_START, get_memcg_info(CGROUP_MEDIUM)->name);
-
-       return RESOURCED_ERROR_NONE;
-}
-
 static inline int calculate_threshold_size(double ratio)
 {
        int size = (double)totalram * ratio / 100.0;
@@ -1917,9 +1896,6 @@ static void print_mem_configs(void)
 
        /* print info of POPUP section */
        _I("[POPUP] oom popup is %s", oom_popup_enable == true ? "enabled" : "disabled");
-
-       /* print info of BackgroundReclaim section */
-       _I("Background reclaim is %s", bg_reclaim == true ? "enabled" : "disabled");
 }
 
 #include "file-helper.h"
@@ -1965,7 +1941,6 @@ static int lowmem_init(void)
 
        register_notifier(RESOURCED_NOTIFIER_APP_PRELAUNCH, lowmem_prelaunch_handler);
        register_notifier(RESOURCED_NOTIFIER_MEM_CONTROL, lowmem_control_handler);
-       register_notifier(RESOURCED_NOTIFIER_LCD_OFF, lowmem_bg_reclaim_handler);
 
        return ret;
 }
@@ -1981,7 +1956,6 @@ static int lowmem_exit(void)
 
        unregister_notifier(RESOURCED_NOTIFIER_APP_PRELAUNCH, lowmem_prelaunch_handler);
        unregister_notifier(RESOURCED_NOTIFIER_MEM_CONTROL, lowmem_control_handler);
-       unregister_notifier(RESOURCED_NOTIFIER_LCD_OFF, lowmem_bg_reclaim_handler);
 
        return RESOURCED_ERROR_NONE;
 }
index 45b8d72..fa7a1b4 100644 (file)
@@ -620,26 +620,6 @@ static void test_proc_dbus_aul_terminate(void **state)
        g_variant_unref(params);
 }
 
-static void test_proc_dbus_lcd_on(void **state)
-{
-       GVariant *params = g_variant_new("(i)", 0);
-
-       expect_value(__wrap_resourced_notify, status, RESOURCED_NOTIFIER_LCD_ON);
-       expect_any(__wrap_resourced_notify, data);
-       proc_dbus_lcd_on(params);
-       g_variant_unref(params);
-}
-
-static void test_proc_dbus_lcd_off(void **state)
-{
-       GVariant *params = g_variant_new("(i)", 0);
-
-       expect_value(__wrap_resourced_notify, status, RESOURCED_NOTIFIER_LCD_OFF);
-       expect_any(__wrap_resourced_notify, data);
-       proc_dbus_lcd_off(params);
-       g_variant_unref(params);
-}
-
 static void test_booting_done_signal_handler(void **state)
 {
        GVariant *params = g_variant_new("(i)", 0);
@@ -742,8 +722,6 @@ int main(int argc, char* argv[])
                cmocka_unit_test(test_proc_dbus_aul_resume),
                cmocka_unit_test(test_proc_dbus_prelaunch_signal_handler),
                cmocka_unit_test(test_proc_dbus_aul_terminate),
-               cmocka_unit_test(test_proc_dbus_lcd_on),
-               cmocka_unit_test(test_proc_dbus_lcd_off),
                cmocka_unit_test(test_booting_done_signal_handler),
                cmocka_unit_test(test_low_battery_signal_handler),
                cmocka_unit_test(test_proc_dbus_suspend_hint),