From: Yosry Ahmed <yosryahmed@google.com>
To: Song Liu <song@kernel.org>
Cc: 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: Wed, 16 Mar 2022 09:13:00 -0700 [thread overview]
Message-ID: <CAJD7tkYGXVX+ehGsOMidfaKCbjuB2HeAK=Up_2evg6iOZD1z-Q@mail.gmail.com> (raw)
In-Reply-To: <CAPhsuW5qHSZNSEh8CQK3wYqtJ4XB+EwFEJWKA9SkA+wGFbvNCg@mail.gmail.com>
On Tue, Mar 15, 2022 at 11:05 PM Song Liu <song@kernel.org> wrote:
>
> On Wed, Mar 9, 2022 at 12:27 PM Yosry Ahmed <yosryahmed@google.com> wrote:
> >
> [...]
> >
> > The map usage by BPF programs and integration with rstat can be as follows:
> > - Internally, each map entry has per-cpu arrays, a total array, and a
> > pending array. BPF programs and user space only see one array.
> > - The update interface is disabled. BPF programs use helpers to modify
> > elements. Internally, the modifications are made to per-cpu arrays,
> > and invoke a call to cgroup_bpf_updated() or an equivalent.
> > - Lookups (from BPF programs or user space) invoke an rstat flush and
> > read from the total array.
>
> Lookups invoke a rstat flush, so we still walk every node of a subtree for
> each lookup, no? So the actual cost should be similar than walking the
> subtree with some BPF program? Did I miss something?
>
Hi Song,
Thanks for taking the time to read my proposal.
The rstat framework maintains a tree that contains only updated
cgroups. An rstat flush only traverses this tree, not the cgroup
subtree/hierarchy.
This also ensures that consecutive readers do not have to do any
traversals unless new updates happen, because the first reader will
have already flushed the stats.
>
> Thanks,
> Song
>
> > - In cgroup_rstat_flush_locked() flush BPF stats as well.
> >
> [...]
next prev parent reply other threads:[~2022-03-16 16:13 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 [this message]
2022-03-16 16:31 ` Tejun Heo
2022-03-18 19:59 ` Song Liu
2022-03-28 9:16 ` Yosry Ahmed
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='CAJD7tkYGXVX+ehGsOMidfaKCbjuB2HeAK=Up_2evg6iOZD1z-Q@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=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