mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Alexei Starovoitov" <alexei.starovoitov@gmail.com>
To: "Shakeel Butt" <shakeel.butt@linux.dev>,
	"Daniel Borkmann" <daniel@iogearbox.net>,
	"John Fastabend" <john.fastabend@gmail.com>,
	"Andrii Nakryiko" <andrii@kernel.org>
Cc: "Eduard Zingerman" <eddyz87@gmail.com>,
	"Kumar Kartikeya Dwivedi" <memxor@gmail.com>,
	"Martin KaFai Lau" <martin.lau@linux.dev>,
	"Song Liu" <song@kernel.org>,
	"Yonghong Song" <yonghong.song@linux.dev>,
	"Jiri Olsa" <jolsa@kernel.org>,
	"Emil Tsalapatis" <emil@etsalapatis.com>,
	"Ihor Solodrai" <ihor.solodrai@linux.dev>,
	"Amery Hung" <ameryhung@gmail.com>, "Tejun Heo" <tj@kernel.org>,
	"Meta kernel team" <kernel-team@meta.com>,
	<cgroups@vger.kernel.org>, <bpf@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>,
	"Yafang Shao" <laoar.shao@gmail.com>
Subject: Re: [PATCH] bpf, cgroup: fix cgroup struct_ops query for a second attach type
Date: Thu, 01 Oct 2026 13:29:01 +0000	[thread overview]
Message-ID: <DLTJD2PTJ81W.FWH9UA1B59MR@gmail.com> (raw)
In-Reply-To: <20260930135159.3926039-1-shakeel.butt@linux.dev>

On Wed, Sep 30, 2026 at 06:51 AM Shakeel Butt <shakeel.butt@linux.dev> wrote:
> +#define cgroup_bpf_enabled_runtime(atype) \
> +	static_key_enabled(&cgroup_bpf_enabled_key[atype])

[...]

> @@ -1448,7 +1449,7 @@ static int __cgroup_bpf_query(struct cgroup *cgrp, const union bpf_attr *attr,
>  			return -ENOENT;
>  		from_atype = to_atype = atype;
>  		flags = 0;
> -		if (!cgroup_bpf_enabled(atype))
> +		if (!cgroup_bpf_enabled_runtime(atype))
>  			goto skip_count;

No need for a new macro.
When the key is off nothing is attached, so progs[atype] and
effective[atype] are empty and the loop below leaves total_cnt at 0.
All other attach types go through that loop without such check.
Just drop the check and the skip_count label.

pw-bot: cr

      parent reply	other threads:[~2026-10-01 13:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-30 13:51 Shakeel Butt
2026-09-30 20:23 ` Amery Hung
2026-09-30 23:32   ` Amery Hung
2026-09-30 23:23 ` Tejun Heo
2026-10-01 13:29 ` Alexei Starovoitov [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=DLTJD2PTJ81W.FWH9UA1B59MR@gmail.com \
    --to=alexei.starovoitov@gmail.com \
    --cc=ameryhung@gmail.com \
    --cc=andrii@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=cgroups@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=emil@etsalapatis.com \
    --cc=ihor.solodrai@linux.dev \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=kernel-team@meta.com \
    --cc=laoar.shao@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=memxor@gmail.com \
    --cc=shakeel.butt@linux.dev \
    --cc=song@kernel.org \
    --cc=tj@kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®