Skip to content

Commit

Permalink
Revert "ck: memcg: Point wb to root memcg/blkcg when offlining to avo…
Browse files Browse the repository at this point in the history
…id zombie"

ANBZ: torvalds#543

This reverts commit cd5f2e4.

The commit cd5f2e4 ("ck: memcg: Point wb to root memcg/blkcg when
offlining to avoid zombie") doesn't cover all scenarios which can cause
zombie memcg/blkcg. It only covers the scenario of memcg/blkcg
offlining, while omitting the scenario where process is switched from
one blkcg to another blkcg (refer cgwb_kill() called in cgwb_create()).

Revert this commit in prep for the following patchset backported from
upstream, which exactly addresses the same issue.

It is worth nothing that, besides the defect described previously,
there's still some visible difference between commit cd5f2e4 and
the scheme from upstream.

1) Commit cd5f2e4 can only avoid zombie memcg, while it can not
avoid zombie blkcg.
2) While blkcg/memcg offlining, all inodes associated with the offlining
cgroup will be switched to the root memcg, while in the upstream scheme,
all associated inodes will be switched to the nearest living ancestor's
wb. This may affect the accounting logic after switching.

Signed-off-by: Jeffle Xu <jefflexu@linux.alibaba.com>
Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com>
Acked-by: Gang Deng <gavin.dg@linux.alibaba.com>
  • Loading branch information
lostjeffle authored and josephhz committed Mar 16, 2022
1 parent d50e2db commit 4b34534
Showing 1 changed file with 2 additions and 18 deletions.
20 changes: 2 additions & 18 deletions mm/backing-dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -964,16 +964,8 @@ void wb_memcg_offline(struct mem_cgroup *memcg)
struct bdi_writeback *wb, *next;

spin_lock_irq(&cgwb_lock);
list_for_each_entry_safe(wb, next, memcg_cgwb_list, memcg_node) {
percpu_ref_get(&wb->refcnt);
list_for_each_entry_safe(wb, next, memcg_cgwb_list, memcg_node)
cgwb_kill(wb);
if (wb->memcg_css) {
css_put(wb->memcg_css);
wb->memcg_css = &root_mem_cgroup->css;
css_get(wb->memcg_css);
}
percpu_ref_put(&wb->refcnt);
}
memcg_cgwb_list->next = NULL; /* prevent new wb's */
spin_unlock_irq(&cgwb_lock);
}
Expand All @@ -989,16 +981,8 @@ void wb_blkcg_offline(struct blkcg *blkcg)
struct bdi_writeback *wb, *next;

spin_lock_irq(&cgwb_lock);
list_for_each_entry_safe(wb, next, &blkcg->cgwb_list, blkcg_node) {
percpu_ref_get(&wb->refcnt);
list_for_each_entry_safe(wb, next, &blkcg->cgwb_list, blkcg_node)
cgwb_kill(wb);
if (wb->memcg_css) {
css_put(wb->memcg_css);
wb->memcg_css = &root_mem_cgroup->css;
css_get(wb->memcg_css);
}
percpu_ref_put(&wb->refcnt);
}
blkcg->cgwb_list.next = NULL; /* prevent new wb's */
spin_unlock_irq(&cgwb_lock);
}
Expand Down

0 comments on commit 4b34534

Please sign in to comment.