From bb33cf580796f0db99aa9b7a66569cd7b4c4f75e Mon Sep 17 00:00:00 2001 From: Unsung Lee Date: Tue, 5 Sep 2023 11:24:00 +0900 Subject: [PATCH] plugin-api: resourced: Add lmk_try_count in get_kill_candidates_post_with_wss resourced-lmk-governor needs to know the number of killing cycle. This is because, the governor should know whether memory thrasing happens or not. If lowmem state is not recovered during the threshold cycle, then the governor skips working set size calculation and does not give benefit to apps with effcient memory usage. Change-Id: I4ba581d10b967665ae3155205cba9b30b0e3fa6b Signed-off-by: Unsung Lee --- .../include/system/syscommon-plugin-resourced-memory-lmk-interface.h | 2 +- .../resourced/include/system/syscommon-plugin-resourced-memory-lmk.h | 3 ++- src/plugin-api/resourced/src/syscommon-plugin-resourced-memory-lmk.c | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/plugin-api/resourced/include/system/syscommon-plugin-resourced-memory-lmk-interface.h b/src/plugin-api/resourced/include/system/syscommon-plugin-resourced-memory-lmk-interface.h index e14f60a..73578aa 100644 --- a/src/plugin-api/resourced/include/system/syscommon-plugin-resourced-memory-lmk-interface.h +++ b/src/plugin-api/resourced/include/system/syscommon-plugin-resourced-memory-lmk-interface.h @@ -100,7 +100,7 @@ typedef struct _syscommon_plugin_backend_resourced_memory_lmk_funcs { GArray *task_info_proc_array, unsigned long totalram_kb); int (*get_kill_candidates_post)(GArray *candidates); - int (*get_kill_candidates_post_with_wss)(GArray *candidates); + int (*get_kill_candidates_post_with_wss)(GArray *candidates, int lmk_try_count); int (*get_kill_candidates_post_with_foreground)(GArray *candidates, enum syscommon_resourced_memory_lmk_oom_level oom_level); } syscommon_plugin_backend_resourced_memory_lmk_funcs; diff --git a/src/plugin-api/resourced/include/system/syscommon-plugin-resourced-memory-lmk.h b/src/plugin-api/resourced/include/system/syscommon-plugin-resourced-memory-lmk.h index b2ac1b0..66525b1 100644 --- a/src/plugin-api/resourced/include/system/syscommon-plugin-resourced-memory-lmk.h +++ b/src/plugin-api/resourced/include/system/syscommon-plugin-resourced-memory-lmk.h @@ -77,11 +77,12 @@ int syscommon_plugin_resourced_memory_lmk_get_kill_candidates_post( according to working set size rule * @param[in] candidates is a GArray to return kill candidates, it is already sorted by get_kill_candidates + * @param[in] lmk_try_count is the number of LMK in a event * @return @c zero on success, * otherwise a negative error value */ int syscommon_plugin_resourced_memory_lmk_get_kill_candidates_post_with_wss( - GArray *candidates); + GArray *candidates, int lmk_try_count); /** * @brief Reorder candidates list sorted first by get_kill_candidates fuction diff --git a/src/plugin-api/resourced/src/syscommon-plugin-resourced-memory-lmk.c b/src/plugin-api/resourced/src/syscommon-plugin-resourced-memory-lmk.c index 6ccb8b2..c5fe92f 100644 --- a/src/plugin-api/resourced/src/syscommon-plugin-resourced-memory-lmk.c +++ b/src/plugin-api/resourced/src/syscommon-plugin-resourced-memory-lmk.c @@ -128,7 +128,7 @@ int syscommon_plugin_resourced_memory_lmk_get_kill_candidates_post( EXPORT int syscommon_plugin_resourced_memory_lmk_get_kill_candidates_post_with_wss( - GArray *candidates) + GArray *candidates, int lmk_try_count) { int ret = 0; @@ -144,7 +144,7 @@ int syscommon_plugin_resourced_memory_lmk_get_kill_candidates_post_with_wss( return -ENOTSUP; } - return funcs->get_kill_candidates_post_with_wss(candidates); + return funcs->get_kill_candidates_post_with_wss(candidates, lmk_try_count); } EXPORT -- 2.7.4