From 52435d72b8bb205ec7ccfb8a988b01c9b20c3cc1 Mon Sep 17 00:00:00 2001 From: Bui Quang Minh Date: Thu, 3 Nov 2022 22:04:53 +0700 Subject: cgroup: Remove redundant code that handles zombie tasks Zombie tasks are dumped in dump_zombies() so it is redundant to handle them in dump_one_task(). Deprecate cg_set in task_core_entry as this field must be per thread now. Signed-off-by: Bui Quang Minh --- criu/cr-dump.c | 9 --------- criu/cr-restore.c | 7 +++++-- images/core.proto | 1 + 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/criu/cr-dump.c b/criu/cr-dump.c index e31b2f702..63eb627fc 100644 --- a/criu/cr-dump.c +++ b/criu/cr-dump.c @@ -811,16 +811,7 @@ static int dump_task_core_all(struct parasite_ctl *ctl, struct pstree_item *item goto err; } - /* - * We don't support multithreads zombie tasks so there is - * no thread_core in zombie tasks, store the cg_set in - * task_core in these cases. - */ cg_set = &core->thread_core->cg_set; - if (item->pid->state == TASK_THREAD) { - core->tc->has_cg_set = true; - cg_set = &core->tc->cg_set; - } ret = dump_thread_cgroup(item, cg_set, info, -1); if (ret) goto err; diff --git a/criu/cr-restore.c b/criu/cr-restore.c index 78f2a9701..974202f16 100644 --- a/criu/cr-restore.c +++ b/criu/cr-restore.c @@ -1350,9 +1350,12 @@ static inline int fork_with_pid(struct pstree_item *item) item->pid->state = ca.core->tc->task_state; - /* Zombie task's cg_set is stored in task_core */ + /* + * Zombie tasks' cgroup is not dumped/restored. + * cg_set == 0 is skipped in prepare_task_cgroup() + */ if (item->pid->state == TASK_DEAD) - rsti(item)->cg_set = ca.core->tc->cg_set; + rsti(item)->cg_set = 0; else rsti(item)->cg_set = ca.core->thread_core->cg_set; diff --git a/images/core.proto b/images/core.proto index 1ee32bfda..bc8b7a488 100644 --- a/images/core.proto +++ b/images/core.proto @@ -40,6 +40,7 @@ message task_core_entry { optional task_timers_entry timers = 7; optional task_rlimits_entry rlimits = 8; + /* This is deprecated, should be per-thread */ optional uint32 cg_set = 9; optional signal_queue_entry signals_s = 10; -- cgit v1.2.3