BPF List
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Shakeel Butt" <shakeel.butt@linux.dev>
Cc: mkoutny@suse.com, bpf@vger.kernel.org, tj@kernel.org, hannes@cmpxchg.org
Subject: Re: [RFC PATCH 2/4] memcg_ext: add cgroup-attached bpf_memcg_ops
Date: Mon, 21 Sep 2026 19:41:46 +0000	[thread overview]
Message-ID: <20260921194146.775051F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260921192559.2619635-3-shakeel.butt@linux.dev>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] bpf: spurious boot warning when CONFIG_CGROUP_BPF is disabled
- [Low] bpf: missing newline in pr_warn for bpf_memcg_ops registration
--

commit f28f15056753b0bfc8cefa4ccf7793b6fb45150d
Author: Shakeel Butt <shakeel.butt@linux.dev>
Subject: memcg_ext: add cgroup-attached bpf_memcg_ops

This patch adds an empty bpf_memcg_ops type for attaching memory policies
to cgroups. It also moves the cgroup BPF attach types outside
CONFIG_CGROUP_BPF and updates the struct_ops registration stub.

> diff --git a/mm/bpf_memcontrol.c b/mm/bpf_memcontrol.c
> index d8f579c285600..fd6dff150f017 100644
> --- a/mm/bpf_memcontrol.c
> +++ b/mm/bpf_memcontrol.c
[ ... ]
> @@ -248,8 +348,14 @@ static int __init bpf_memcontrol_init(void)
>  
>  	err = register_btf_kfunc_id_set(BPF_PROG_TYPE_SYSCALL,
>  					&bpf_memcontrol_reclaim_kfunc_set);
> -	if (err)
> +	if (err) {
>  		pr_warn("error registering bpf reclaim kfuncs: %d\n", err);
> +		return err;
> +	}
> +
> +	err = bpf_memcg_ops_register();
> +	if (err)
> +		pr_warn("error while registering bpf_memcg_ops: %d", err);

[Severity: Medium]
Will this print a spurious warning on every boot when CONFIG_CGROUP_BPF is
disabled?

If a kernel is built with CONFIG_MEMCG=y, CONFIG_BPF_SYSCALL=y, and
CONFIG_BPF_JIT=y, but CONFIG_CGROUP_BPF=n, bpf_memcontrol_init() calls
bpf_memcg_ops_register().

This eventually calls register_bpf_struct_ops(), which relies on
cgroup_bpf_is_struct_ops_atype() in btf_add_struct_ops(). Since the
!CONFIG_CGROUP_BPF stub for cgroup_bpf_is_struct_ops_atype() unconditionally
returns false, this returns -EINVAL.

Does this mean the late initcall will return an error and unconditionally
pollute the kernel log with this warning on supported configurations?

[Severity: Low]
Does this pr_warn() need a terminating '\n'?

Without it, subsequent printk messages might be incorrectly appended to the
same line in the kernel log.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260921192559.2619635-1-shakeel.butt@linux.dev?part=2

  reply	other threads:[~2026-09-21 19:41 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-21 19:25 [RFC PATCH 0/4] memcg_ext: memcg policy through cgroup-attached struct_ops Shakeel Butt
2026-09-21 19:25 ` [RFC PATCH 1/4] bpf, cgroup: fix cgroup struct_ops query for a second attach type Shakeel Butt
2026-09-21 20:19   ` bot+bpf-ci
2026-09-29 11:49   ` Yafang Shao
2026-09-21 19:25 ` [RFC PATCH 2/4] memcg_ext: add cgroup-attached bpf_memcg_ops Shakeel Butt
2026-09-21 19:41   ` sashiko-bot [this message]
2026-09-21 19:25 ` [RFC PATCH 3/4] memcg_ext: allow BPF to defer memory.high enforcement Shakeel Butt
2026-09-24 20:14   ` JP Kobryn
2026-09-24 21:19     ` Shakeel Butt
2026-09-21 19:25 ` [RFC PATCH 4/4] selftests/bpf: add a cgroupfs lock-holder bpf_memcg_ops sample Shakeel Butt
2026-09-23 13:07 ` [RFC PATCH 0/4] memcg_ext: memcg policy through cgroup-attached struct_ops Yafang Shao
2026-09-23 15:47   ` Shakeel Butt
2026-09-24 10:01     ` Yafang Shao
2026-09-24 20:42       ` Shakeel Butt
2026-09-28  3:23         ` Yafang Shao
2026-09-28 20:40 ` Tejun Heo
2026-09-30 13:28   ` Shakeel Butt
2026-09-30 23:35     ` Tejun Heo
2026-10-01  1:00       ` Shakeel Butt
2026-10-01 18:42         ` Tejun Heo
2026-10-01 22:56           ` Shakeel Butt
2026-10-02 16:25             ` Tejun Heo
2026-10-02 22:19               ` Shakeel Butt
2026-10-03  7:17                 ` Tejun Heo

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=20260921194146.775051F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=hannes@cmpxchg.org \
    --cc=mkoutny@suse.com \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=shakeel.butt@linux.dev \
    --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