summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSangYoun Kwak <sy.kwak@samsung.com>2024-04-04 15:38:53 +0900
committerSangYoun Kwak <sy.kwak@samsung.com>2024-04-04 16:05:42 +0900
commita8d05e770e94d2af3bbc6dbd65363531e61a117c (patch)
treeb7776c7b1c4199fe41eb7549721a0cbb08f8b62d
parentb626022f19814dd8fafd15325de5c0fca3bff6f5 (diff)
downloadresourced-a8d05e770e94d2af3bbc6dbd65363531e61a117c.tar.gz
resourced-a8d05e770e94d2af3bbc6dbd65363531e61a117c.tar.bz2
resourced-a8d05e770e94d2af3bbc6dbd65363531e61a117c.zip
Previously, if pid is child's pid and try to move cgroup of it, resourced does nothing because child pids should be moved with their parent process. In the case of Android app, its pid should be grouped with its corresponding dummy app(Tizen app, android-launcher), but it is treated as a child of dummy app, resourced does nothing and it is not registered to the cgroup's tasks. To fix this issue, modify to call lowmem_limit_move_cgroup() to write all pids of parent process even if the target(to move cgroup) is child pid. Change-Id: I0fd516025e2f0dddd4571f5325c54ef44296bc1c Signed-off-by: SangYoun Kwak <sy.kwak@samsung.com>
-rw-r--r--src/resource-limiter/memory/lowmem-controller.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/resource-limiter/memory/lowmem-controller.c b/src/resource-limiter/memory/lowmem-controller.c
index ecfcf3e9..379257a2 100644
--- a/src/resource-limiter/memory/lowmem-controller.c
+++ b/src/resource-limiter/memory/lowmem-controller.c
@@ -358,8 +358,27 @@ static void lowmem_move_memcgroup(int pid, int next_oom_score_adj, struct proc_a
switch (next_memcg_idx) {
case MEMCG_ROOT:
case MEMCG_BACKGROUND_LRU:
- if (pai->memory.use_mem_limit)
+ if (pai->memory.use_mem_limit) {
+ /**
+ * FIXME:
+ * Calling lowmem_limit_move_cgroup will write
+ * all pids in the pai to its corresponding
+ * cgroup node.
+ * Normally, it has no effect but can fix
+ * abnormal situation such as 'some pids are
+ * added to the pai but not appeared in the
+ * cgroup'.
+ * This situation can be generated when the
+ * "AppGroup" signal is sent from the AMD but
+ * the child pid to group with is not managed by
+ * the resourced.
+ */
+ int ret = lowmem_limit_move_cgroup(pai);
+ assert(ret != RESOURCED_ERROR_NO_DATA);
+ if (ret != RESOURCED_ERROR_NONE)
+ _E("Failed to move cgroup for child pid(%d)", pid);
return;
+ }
break;
case MEMCG_BACKGROUND_MRU:
break;