On Wed 06-07-22 10:40:48, Yafang Shao wrote: > On Wed, Jul 6, 2022 at 4:52 AM Roman Gushchin <roman.gushchin@xxxxxxxxx> wrote: > > > > On Mon, Jul 04, 2022 at 05:30:25PM +0200, Michal Hocko wrote: > > > On Mon 04-07-22 17:07:32, Michal Hocko wrote: > > > > On Sat 02-07-22 08:39:14, Roman Gushchin wrote: > > > > > On Fri, Jul 01, 2022 at 10:50:40PM -0700, Shakeel Butt wrote: > > > > > > On Fri, Jul 1, 2022 at 8:35 PM Roman Gushchin <roman.gushchin@xxxxxxxxx> wrote: > > > > > > > > > > > > > > Yafang Shao reported an issue related to the accounting of bpf > > > > > > > memory: if a bpf map is charged indirectly for memory consumed > > > > > > > from an interrupt context and allocations are enforced, MEMCG_MAX > > > > > > > events are not raised. > > > > > > > > > > > > > > It's not/less of an issue in a generic case because consequent > > > > > > > allocations from a process context will trigger the reclaim and > > > > > > > MEMCG_MAX events. However a bpf map can belong to a dying/abandoned > > > > > > > memory cgroup, so it might never happen. > > > > > > > > > > > > The patch looks good but the above sentence is confusing. What might > > > > > > never happen? Reclaim or MAX event on dying memcg? > > > > > > > > > > Direct reclaim and MAX events. I agree it might be not clear without > > > > > looking into the code. How about something like this? > > > > > > > > > > "It's not/less of an issue in a generic case because consequent > > > > > allocations from a process context will trigger the direct reclaim > > > > > and MEMCG_MAX events will be raised. However a bpf map can belong > > > > > to a dying/abandoned memory cgroup, so there will be no allocations > > > > > from a process context and no MEMCG_MAX events will be triggered." > > > > > > > > Could you expand little bit more on the situation? Can those charges to > > > > offline memcg happen indefinetely? How can it ever go away then? Also is > > > > this something that we actually want to encourage? > > > > > > One more question. Mostly out of curiosity. How is userspace actually > > > acting on those events? Are watchers still active on those dead memcgs? > > > > Idk, the whole problem was reported by Yafang, so he probably has a better > > answer. But in general events are recursive and the cgroup doesn't have > > to be dying, it can be simple abandoned. > > > > Regarding the pinned bpf programs, it can run without a user agent. > That means the cgroup may not be dead, but just not populated. > (But in our case, the cgroup will be deleted after the user agent exits.) OK, that makes sense. -- Michal Hocko SUSE Labs