From: Yosry Ahmed <yosryahmed@google.com>
To: Song Liu <song@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>,
Alexei Starovoitov <ast@kernel.org>,
Andrii Nakryiko <andrii@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Johannes Weiner <hannes@cmpxchg.org>,
Hao Luo <haoluo@google.com>, Shakeel Butt <shakeelb@google.com>,
Stanislav Fomichev <sdf@google.com>,
David Rientjes <rientjes@google.com>, bpf <bpf@vger.kernel.org>,
KP Singh <kpsingh@kernel.org>,
cgroups@vger.kernel.org, Linux-MM <linux-mm@kvack.org>
Subject: Re: [RFC bpf-next] Hierarchical Cgroup Stats Collection Using BPF
Date: Mon, 28 Mar 2022 02:16:53 -0700 [thread overview]
Message-ID: <CAJD7tkaS0k9TVvsDDKP1XCahJ1TyJeSyRHGSM+NZygFwMD=wzQ@mail.gmail.com> (raw)
In-Reply-To: <CAPhsuW6QTaCVekkT8Ah0N2K4JY7yiiO2wZjk6pVKuraEqjkoXQ@mail.gmail.com>
On Fri, Mar 18, 2022 at 12:59 PM Song Liu <song@kernel.org> wrote:
>
> On Wed, Mar 9, 2022 at 12:27 PM Yosry Ahmed <yosryahmed@google.com> wrote:
> >
> > Hey everyone,
> >
> > I would like to discuss an idea to facilitate collection of
> > hierarchical cgroup stats using BPF programs. We want to provide a
> > simple interface for BPF programs to collect hierarchical cgroup stats
> > and integrate with the existing rstat aggregation mechanism in the
> > kernel. The most prominent use case is the ability to extend memcg
> > stats (and histograms) by BPF programs.
> >
>
> + Namhyung,
>
> I forgot to mention this in the office hour. The aggregation efficiency
> problem is actually similar to Namhyung's work to use BPF programs
> to aggregate perf counters. Check:
> tools/perf/util/bpf_skel/bperf_cgroup.bpf.c
>
> Namhyung's solution is to walk up the cgroup tree on cgroup switch
> events. This may not be as efficient as rstat flush logic, but I think it
> is good enough for many use cases (unless the cgroup tree is very
> deep). It also demonstrates how we can implement some cgroup
> logic in BPF.
>
> I hope this helps.
>
> Thanks,
> Song
>
> [...]
Hi Song,
Thanks so much for pointing this out. I have an idea of a less
intrusive and more generic way to directly use rstat flushing in BPF
programs, which basically makes BPF programs maintain their own stats
and flushing logic and only using helpers to make calls to rstat
(instead of a whole new rstat map). I will work on an RFC patch series
for this.
If this doesn't work out, I will probably fallback to handling the
flushing completely in the BPF programs, similar to the example you
provided (which is a lot of help, thanks!).
prev parent reply other threads:[~2022-03-28 9:17 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-09 20:27 Yosry Ahmed
2022-03-14 5:35 ` Tejun Heo
2022-03-16 16:35 ` Yosry Ahmed
2022-03-22 18:09 ` Yonghong Song
2022-03-22 21:37 ` Hao Luo
2022-03-22 22:06 ` Yonghong Song
2022-03-28 9:22 ` Yosry Ahmed
2022-03-16 6:04 ` Song Liu
2022-03-16 16:11 ` Yosry Ahmed
2022-03-16 16:13 ` Yosry Ahmed
2022-03-16 16:31 ` Tejun Heo
2022-03-18 19:59 ` Song Liu
2022-03-28 9:16 ` Yosry Ahmed [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAJD7tkaS0k9TVvsDDKP1XCahJ1TyJeSyRHGSM+NZygFwMD=wzQ@mail.gmail.com' \
--to=yosryahmed@google.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=cgroups@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=hannes@cmpxchg.org \
--cc=haoluo@google.com \
--cc=kpsingh@kernel.org \
--cc=linux-mm@kvack.org \
--cc=namhyung@kernel.org \
--cc=rientjes@google.com \
--cc=sdf@google.com \
--cc=shakeelb@google.com \
--cc=song@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox