All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eduard Zingerman <eddyz87@gmail.com>
To: bpf@vger.kernel.org, ast@kernel.org
Cc: andrii@kernel.org, daniel@iogearbox.net, martin.lau@linux.dev,
	 kernel-team@fb.com, yonghong.song@linux.dev
Subject: Re: [PATCH bpf-next v1 2/2] veristat: memory accounting for bpf programs
Date: Thu, 05 Jun 2025 18:03:55 -0700	[thread overview]
Message-ID: <8bf346133b103ee586f7ffd1a47572f9ee000704.camel@gmail.com> (raw)
In-Reply-To: <20250605230609.1444980-3-eddyz87@gmail.com>

On Thu, 2025-06-05 at 16:06 -0700, Eduard Zingerman wrote:

[...]

> +/*
> + * Enters new cgroup namespace and mounts cgroupfs at /tmp/veristat-cgroup-mount-XXXXXX,
> + * enables "memory" controller for the root cgroup.
> + */
> +static int mount_cgroupfs(void)
> +{
> +	char buf[PATH_MAX + 1];
> +	int err;
> +
> +	env.memory_peak_fd = -1;
> +
> +	err = unshare(CLONE_NEWCGROUP);
> +	if (err < 0) {
> +		err = log_errno("unshare(CLONE_NEWCGROUP)");
> +		goto err_out;
> +	}

The `unshare` call is useless. I thought it would grant me a new
hierarchy with separate cgroup.subtree_control in the root.
But that's now how things work, hierarchy is shared across namespaces.
I'll drop this call and just complain if "memory" controller is not enabled.

The "mount" part can remain, I use it to avoid searching for cgroupfs
mount point. Alternatively I can inspect /proc/self/mountinfo and
complain if cgroupfs is not found. Please let me know which way is
preferred.

[...]


  reply	other threads:[~2025-06-06  1:03 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-05 23:06 [PATCH bpf-next v1 0/2] veristat: memory accounting for bpf programs Eduard Zingerman
2025-06-05 23:06 ` [PATCH bpf-next v1 1/2] bpf: include verifier memory allocations in memcg statistics Eduard Zingerman
2025-06-05 23:06 ` [PATCH bpf-next v1 2/2] veristat: memory accounting for bpf programs Eduard Zingerman
2025-06-06  1:03   ` Eduard Zingerman [this message]
2025-06-06  2:17     ` Alexei Starovoitov
2025-06-06  2:33       ` Eduard Zingerman
2025-06-06  2:35         ` Alexei Starovoitov
2025-06-06  2:46           ` Eduard Zingerman
2025-06-06 16:53   ` Mykyta Yatsenko
2025-06-06 17:03     ` Eduard Zingerman
2025-06-06 18:19       ` Andrii Nakryiko
2025-06-07  8:13         ` Eduard Zingerman
2025-06-09 20:57           ` Andrii Nakryiko
2025-06-09 22:45             ` Eduard Zingerman

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=8bf346133b103ee586f7ffd1a47572f9ee000704.camel@gmail.com \
    --to=eddyz87@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=kernel-team@fb.com \
    --cc=martin.lau@linux.dev \
    --cc=yonghong.song@linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.