Re: [V2][PATCH] cgroup: fix memory leak caused by missing cgroup_bpf_offline

From
Quanyang Wang <hidden>
Date
2021-10-20 05:16:55
Also in
bpf, cgroups, lkml
Reply to
Michal Koutný, 2021-10-19
Hi Michal,

On 10/20/21 1:10 AM, Michal Koutný wrote:
Hi.

On Tue, Oct 19, 2021 at 06:41:14PM +0800, Quanyang Wang [off-list ref] wrote:
quoted
So I add 2 "Fixes tags" here to indicate that 2 commits introduce two
different issues.
AFAIU, both the changes are needed to cause the leak, a single patch
alone won't cause the issue. Is that correct? (Perhaps not as I realize,
see below.)
Yes, I back to the earlier commit 4bfc0bb2c60e and no memory leak is observed.
But on second thought, the problem is the missing percpu_ref_exit() in
the (root) cgroup release path and percpu counter would allocate the
percpu_count_ptr anyway, so 4bfc0bb2c60e is only making the leak more
visible. Is this correct?
No, the earlier commit 4bfc0bb2c60e introduces a imbalance and the later
commit 2b0d3d3e4fcf introduces a visible leak.

Thanks,
Quanyang
I agree the commit 2b0d3d3e4fcf ("percpu_ref: reduce memory footprint of
percpu_ref in fast path") alone did nothing wrong.

[On a related (but independent) note, there seems to be an optimization
opportunity in not dealing with cgroup_bpf at all on the non-default
hierarchies.]

Regards,
Michal
Thread (15 messages) 15 messages, 5 authors, last reply 2021-10-22
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help