Re: [PATCH v2 4/4] samples: bpf: add mthp_ext

From: bot+bpf-ci

Date: Fri May 08 2026 - 11:46:34 EST


> diff --git a/samples/bpf/.gitignore b/samples/bpf/.gitignore
> index 0002cd359fb1..2a73581876b4 100644
> --- a/samples/bpf/.gitignore
> +++ b/samples/bpf/.gitignore

[ ... ]

> diff --git a/samples/bpf/mthp_ext.c b/samples/bpf/mthp_ext.c
> new file mode 100644
> index 000000000000..120c331ff26a
> --- /dev/null
> +++ b/samples/bpf/mthp_ext.c

[ ... ]

> @@ -0,0 +1,339 @@
> +// SPDX-License-Identifier: GPL-2.0
> +
> +#include <stdio.h>
> +#include <stdlib.h>
> +#include <stdint.h>
> +#include <string.h>
> +#include <errno.h>
> +#include <fcntl.h>
> +#include <unistd.h>
> +#include <signal.h>
> +#include <time.h>
> +#include <stdbool.h>
> +#include <getopt.h>
> +#include <sys/epoll.h>
> +#include <sys/stat.h>
> +#include <linux/limits.h>
> +#include <linux/bpf.h>
> +#include <bpf/bpf.h>
> +#include <bpf/libbpf.h>
> +#include "mthp_ext.h"
> +#include "mthp_ext.skel.h"

[ ... ]

> +int main(int argc, char **argv)
> +{
> + const char *root_path = DEFAULT_ROOT;
> + unsigned long threshold = DEFAULT_THRESHOLD_MS;
> + unsigned long interval = DEFAULT_INTERVAL_MS;
> + unsigned int init_order = DEFAULT_ORDER;
> + unsigned int min_mem = DEFAULT_MIN_MEM;
> + bool fixed = false;
> + bool debug = false;
> + struct mthp_ext *skel;
> + struct bpf_link *iter_link;
> + struct bpf_link *ops_link;
> + struct ring_buffer *rb;
> + int root_fd;
> + int psi_fd;
> + int err = 0;
> + int opt;

[ ... ]

> + /* Attach struct_ops to root cgroup for mthp_choose */
> + DECLARE_LIBBPF_OPTS(bpf_struct_ops_opts, opts);
> + opts.flags = BPF_F_CGROUP_FD;
> + opts.target_fd = root_fd;
> + ops_link = bpf_map__attach_struct_ops_opts(skel->maps.mthp_ops, &opts);
> + err = libbpf_get_error(ops_link);

Will mthp_ext compile with these symbols? bot+bpf-ci@xxxxxxxxxx noted in
v1 that bpf_struct_ops_opts, BPF_F_CGROUP_FD, and
bpf_map__attach_struct_ops_opts() do not exist anywhere in the kernel
source tree:

https://lore.kernel.org/bpf/c13f99d42c434ec73ec1e8cf1141047146ab359e60e56e78e1c32554d6e01e9b@xxxxxxxxxxxxxxx/

The struct bpf_struct_ops_opts type is not defined in
tools/lib/bpf/libbpf.h.

The BPF_F_CGROUP_FD flag does not appear in include/uapi/linux/bpf.h or
any other header.

The bpf_map__attach_struct_ops_opts() function is not declared in
libbpf.h or exported in tools/lib/bpf/libbpf.map.

You mentioned in your response that this depends on patches from the 'mm:
BPF OOM' series (PATCH#2), but this dependency was not addressed in v2 -
the same non-existent API calls remain in the code.

Should this series explicitly list the dependency on the 'mm: BPF OOM'
PATCH#2 in the cover letter?

[ ... ]


---
AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md

CI run summary: https://github.com/kernel-patches/bpf/actions/runs/25563319416