perf cgroup: Introduce cgroup__delete()

Just to make this code look more like other places in tools/perf.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Wang Nan <wangnan0@huawei.com>
Link: https://lkml.kernel.org/n/tip-j3j72vvn2d5j7tenlghdy195@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
上级 3ca32f69
...@@ -144,12 +144,17 @@ static int add_cgroup(struct perf_evlist *evlist, char *str) ...@@ -144,12 +144,17 @@ static int add_cgroup(struct perf_evlist *evlist, char *str)
return 0; return 0;
} }
static void cgroup__delete(struct cgroup *cgroup)
{
close(cgroup->fd);
zfree(&cgroup->name);
free(cgroup);
}
void close_cgroup(struct cgroup *cgrp) void close_cgroup(struct cgroup *cgrp)
{ {
if (cgrp && refcount_dec_and_test(&cgrp->refcnt)) { if (cgrp && refcount_dec_and_test(&cgrp->refcnt)) {
close(cgrp->fd); cgroup__delete(cgrp);
zfree(&cgrp->name);
free(cgrp);
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册