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;