Re: [PATCH 2/5] bpf: Expose pinned arenas as sized bpffs files
From: bot+bpf-ci
Date: Sat Oct 10 2026 - 19:41:12 EST
> bpf: Expose pinned arenas as sized bpffs files
TL;DR: Nits only in bpf_mkmap() in kernel/bpf/inode.c: the nested ternary
could be an early return, continuation indentation is off, and the
arena-export predicate duplicated in bpf_map_setattr() could be shared.
> diff --git a/kernel/bpf/inode.c b/kernel/bpf/inode.c
> index 7837968c0842..d3dc6f70e32a 100644
> --- a/kernel/bpf/inode.c
> +++ b/kernel/bpf/inode.c
[ ... ]
> @@ -390,16 +469,20 @@ static int bpf_mkobj_ops(struct dentry *dentry, umode_t mode, void *raw,
> static int bpf_mkprog(struct dentry *dentry, umode_t mode, void *arg)
> {
> return bpf_mkobj_ops(dentry, mode, arg, &bpf_prog_iops,
> - &bpffs_obj_fops);
> + &bpffs_obj_fops, 0);
> }
>
> static int bpf_mkmap(struct dentry *dentry, umode_t mode, void *arg)
> {
> struct bpf_map *map = arg;
> + bool shared_arena = map->map_type == BPF_MAP_TYPE_ARENA &&
> + (map->map_flags & BPF_F_ARENA_EXPORT);
>
> return bpf_mkobj_ops(dentry, mode, arg, &bpf_map_iops,
> - bpf_map_support_seq_show(map) ?
> - &bpffs_map_fops : &bpffs_obj_fops);
> + shared_arena ? &bpffs_arena_fops :
> + bpf_map_support_seq_show(map) ?
> + &bpffs_map_fops : &bpffs_obj_fops,
> + shared_arena ? (loff_t)map->max_entries * PAGE_SIZE : 0);
> }
This isn't a bug, but would it read more simply to handle the exported arena
case with an early return in bpf_mkmap(), rather than testing shared_arena
twice inside a nested ternary in the argument list?
The continuation lines here are also indented one column short of the open
parenthesis, unlike the matching call in bpf_mklink().
The same 'map->map_type == BPF_MAP_TYPE_ARENA && (map->map_flags &
BPF_F_ARENA_EXPORT)' predicate is repeated in bpf_map_setattr(). Could it be
shared through a small helper, or could bpf_map_setattr() check
inode->i_fop == &bpffs_arena_fops instead?
---
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/38093513563