LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Alexei Starovoitov <alexei.starovoitov@gmail.com>
To: Alban Crequy <alban.crequy@gmail.com>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
containers@lists.linux-foundation.org, cgroups@vger.kernel.org,
Alban Crequy <alban@kinvolk.io>,
tj@kernel.org
Subject: Re: [PATCH] [RFC] bpf: tracing: new helper bpf_get_current_cgroup_ino
Date: Mon, 21 May 2018 09:26:11 -0700 [thread overview]
Message-ID: <20180521162609.lpdrnozowmzdn57m@ast-mbp.dhcp.thefacebook.com> (raw)
In-Reply-To: <20180513173318.21680-1-alban@kinvolk.io>
On Sun, May 13, 2018 at 07:33:18PM +0200, Alban Crequy wrote:
>
> +BPF_CALL_2(bpf_get_current_cgroup_ino, u32, hierarchy, u64, flags)
> +{
> + // TODO: pick the correct hierarchy instead of the mem controller
> + struct cgroup *cgrp = task_cgroup(current, memory_cgrp_id);
> +
> + if (unlikely(!cgrp))
> + return -EINVAL;
> + if (unlikely(hierarchy))
> + return -EINVAL;
> + if (unlikely(flags))
> + return -EINVAL;
> +
> + return cgrp->kn->id.ino;
ino only is not enough to identify cgroup. It needs generation number too.
I don't quite see how hierarchy and flags can be used in the future.
Also why limit it to memcg?
How about something like this instead:
BPF_CALL_2(bpf_get_current_cgroup_id)
{
struct cgroup *cgrp = task_dfl_cgroup(current);
return cgrp->kn->id.id;
}
The user space can use fhandle api to get the same 64-bit id.
next prev parent reply other threads:[~2018-05-21 16:26 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-13 17:33 [PATCH] [RFC] bpf: tracing: new helper bpf_get_current_cgroup_ino Alban Crequy
2018-05-14 19:38 ` Y Song
2018-05-21 13:52 ` Alban Crequy
2018-05-21 16:26 ` Alexei Starovoitov [this message]
2018-05-22 0:24 ` Y Song
2018-05-23 3:33 ` Y Song
2018-05-23 3:35 ` Alexei Starovoitov
2018-05-23 4:31 ` Y Song
2018-05-23 8:57 ` Daniel Borkmann
2018-05-25 15:21 ` Alban Crequy
2018-05-25 16:28 ` Y Song
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=20180521162609.lpdrnozowmzdn57m@ast-mbp.dhcp.thefacebook.com \
--to=alexei.starovoitov@gmail.com \
--cc=alban.crequy@gmail.com \
--cc=alban@kinvolk.io \
--cc=cgroups@vger.kernel.org \
--cc=containers@lists.linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=tj@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;
as well as URLs for NNTP newsgroup(s).