lowmem-controller: Exclude app from kill when is_killed_free_from is true 83/298383/3 accepted/tizen/unified/20230907.175319
authorUnsung Lee <unsung.lee@samsung.com>
Tue, 5 Sep 2023 12:16:44 +0000 (21:16 +0900)
committerUnsung Lee <unsung.lee@samsung.com>
Wed, 6 Sep 2023 08:56:14 +0000 (17:56 +0900)
Exclude app from LMK from kill when is_killed_free_from is true.
This value can be set by LMK governor post function in resourced LMK plugin backend.

Change-Id: I2b70370d05c9e08fbb7d168cb8c2717faa44a028
Signed-off-by: Unsung Lee <unsung.lee@samsung.com>
src/resource-limiter/memory/lowmem-controller.c

index 4c4ef4b..f418483 100644 (file)
@@ -155,7 +155,7 @@ static int lowmem_controller_kill_candidates(GArray *candidates,
        for (int i = 0; i < candidates->len; i++) {
                struct task_info *tsk;
 
-               if (i >= max_victims) {
+               if (victim_cnt >= max_victims) {
                        killer_status = LOWMEM_RECLAIM_NEXT_TYPE;
                        break;
                }
@@ -179,6 +179,10 @@ static int lowmem_controller_kill_candidates(GArray *candidates,
                }
 
                tsk = g_array_index(candidates, struct task_info *, i);
+               if (tsk->is_free_from_kill) {
+                       _I("[LMK] pid  = %d is free from kill", tsk->pid);
+                       continue;
+               }
 
                killer_status = lowmem_check_kill_continued(tsk, flags,
                                                        lmk_start_threshold_mb);