From 71da9223e76231608dc614f0a46eeb56d0d7ef3d Mon Sep 17 00:00:00 2001 From: Dongwoo Lee Date: Mon, 11 Apr 2022 20:28:37 +0900 Subject: [PATCH] resource: process-group: Fix unnecessary assignment and meaningless code Change-Id: I600fc27afa7ecb95853bc492bd997ee8d99d1e9a Signed-off-by: Dongwoo Lee --- src/resource/resource-process-group.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/resource/resource-process-group.c b/src/resource/resource-process-group.c index 959ef43..caab3a0 100644 --- a/src/resource/resource-process-group.c +++ b/src/resource/resource-process-group.c @@ -387,7 +387,7 @@ static int update_aggr_taskstats(struct process_group_context *ctx) if (!curr) return -ENOMEM; - ret = kernel_get_thread_group_taskstats(curr, pid, true); + ret = kernel_get_thread_group_taskstats(curr, pid, false); if (ret < 0) { free(curr); g_hash_table_iter_remove(&iter); @@ -395,7 +395,7 @@ static int update_aggr_taskstats(struct process_group_context *ctx) } if (!prev) { - node->stats = node->prev = curr; + node->prev = curr; continue; } @@ -418,7 +418,6 @@ static int update_aggr_taskstats(struct process_group_context *ctx) / (curr->ac_etime - prev->ac_etime); free(prev); node->prev = curr; - node->stats = curr; } return 0; @@ -506,14 +505,9 @@ static int process_group_prepare_update(struct resource *res) } g_hash_table_iter_init(&iter, ctx->pi_map); - while (g_hash_table_iter_next(&iter, &key, &value)) { - pnode = (struct process_info_node *)value; - if (!g_hash_table_contains(process_hash, key)) { - pnode = (struct process_info_node *)value; - + while (g_hash_table_iter_next(&iter, &key, &value)) + if (!g_hash_table_contains(process_hash, key)) g_hash_table_iter_remove(&iter); - } - } if (ctx->pid < 0) { /* just add all processes into array if parent pid is negative */ -- 2.7.4