Skip to content

Commit

Permalink
cgroup debug
Browse files Browse the repository at this point in the history
Signed-off-by: Tadeusz Struk <tadeusz.struk@linaro.org>
Change-Id: I5b2f8b97e4885490209346f586cd225309155e7c
  • Loading branch information
tstruk committed Jun 6, 2022
1 parent 07b78bf commit cb15f4b
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion kernel/cgroup/cgroup.c
Expand Up @@ -958,6 +958,8 @@ void put_css_set_locked(struct css_set *cset)
/* This css_set is dead. unlink it and release cgroup and css refs */
for_each_subsys(ss, ssid) {
list_del(&cset->e_cset_node[ssid]);

printk("!!!! put_css_set_locked css_put(%llx) \n", cset->subsys[ssid]);
css_put(cset->subsys[ssid]);
}
hash_del(&cset->hlist);
Expand All @@ -966,8 +968,10 @@ void put_css_set_locked(struct css_set *cset)
list_for_each_entry_safe(link, tmp_link, &cset->cgrp_links, cgrp_link) {
list_del(&link->cset_link);
list_del(&link->cgrp_link);
if (cgroup_parent(link->cgrp))
if (cgroup_parent(link->cgrp)) {
printk("!!!! put_css_set_locked cgroup_put(self %llx) \n", &link->cgrp->self);
cgroup_put(link->cgrp);
}
kfree(link);
}

Expand Down Expand Up @@ -1581,6 +1585,7 @@ void cgroup_kn_unlock(struct kernfs_node *kn)
mutex_unlock(&cgroup_mutex);

kernfs_unbreak_active_protection(kn);
printk("!!!! cgroup_kn_unlock css_put(%llx) \n", &cgrp->self);
cgroup_put(cgrp);
}

Expand Down Expand Up @@ -3156,6 +3161,7 @@ static void cgroup_apply_control_disable(struct cgroup *cgrp)

if (css->parent &&
!(cgroup_ss_mask(dsct) & (1 << ss->id))) {
printk("!!!! control_disable kill_css(%llx) \n", css);
kill_css(css);
} else if (!css_visible(css)) {
css_clear_dir(css);
Expand Down Expand Up @@ -5142,6 +5148,7 @@ static void css_release(struct percpu_ref *ref)
struct cgroup_subsys_state *css =
container_of(ref, struct cgroup_subsys_state, refcnt);

printk("!!!! css_release enqueue(%llx) \n", css);
INIT_WORK(&css->destroy_work, css_release_work_fn);
queue_work(cgroup_destroy_wq, &css->destroy_work);
}
Expand Down Expand Up @@ -5234,6 +5241,7 @@ static struct cgroup_subsys_state *css_create(struct cgroup *cgrp,
lockdep_assert_held(&cgroup_mutex);

css = ss->css_alloc(parent_css);
printk("!!!! css_create css %llx !!!!\n", css);
if (!css)
css = ERR_PTR(-ENOMEM);
if (IS_ERR(css))
Expand Down Expand Up @@ -5273,6 +5281,7 @@ static struct cgroup_subsys_state *css_create(struct cgroup *cgrp,
list_del_rcu(&css->sibling);
err_free_css:
list_del_rcu(&css->rstat_css_node);
printk("!!!! css_create rcu_enqueue(%llx) !!!!\n", css);
INIT_RCU_WORK(&css->destroy_rwork, css_free_rwork_fn);
queue_rcu_work(cgroup_destroy_wq, &css->destroy_rwork);
return ERR_PTR(err);
Expand Down Expand Up @@ -5496,6 +5505,7 @@ static void css_killed_work_fn(struct work_struct *work)

do {
offline_css(css);
printk("!!!! css_killed_work_fn css_put(%llx) \n", css);
css_put(css);
/* @css can't go away while we're holding cgroup_mutex */
css = css->parent;
Expand All @@ -5510,7 +5520,9 @@ static void css_killed_ref_fn(struct percpu_ref *ref)
struct cgroup_subsys_state *css =
container_of(ref, struct cgroup_subsys_state, refcnt);


if (atomic_dec_and_test(&css->online_cnt)) {
printk("!!!! css_killed_ref_fn enqueue(%llx) \n", css);
INIT_WORK(&css->destroy_work, css_killed_work_fn);
queue_work(cgroup_destroy_wq, &css->destroy_work);
}
Expand Down Expand Up @@ -6602,6 +6614,7 @@ void cgroup_sk_free(struct sock_cgroup_data *skcd)
if (skcd->no_refcnt)
return;
cgroup_bpf_put(cgrp);
printk("!!!! cgroup_sk_free cgroup_put(css %llx)\n", &cgrp->self);
cgroup_put(cgrp);
}

Expand Down

0 comments on commit cb15f4b

Please sign in to comment.