Message ID | 20230913135943.3137292-1-houtao@huaweicloud.com (mailing list archive) |
---|---|
State | Accepted |
Commit | dca7acd84e93f2881e3f63465bbb5d89a40b5d17 |
Delegated to: | BPF |
Headers | show |
Series | [bpf] bpf: Skip unit_size checking for global per-cpu allocator | expand |
Hi Hou Tao, Thanks for the patch. > Subject: [PATCH bpf] bpf: Skip unit_size checking for global per-cpu > allocator > > From: Hou Tao <houtao1@huawei.com> > > For global per-cpu allocator, the size of free object in free list doesn't > match with unit_size and now there is no way to get the size of per-cpu > pointer saved in free object, so just skip the checking. > > Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> > Closes: > Signed-off-by: Hou Tao <houtao1@huawei.com> Tested-by: Biju Das <biju.das.jz@bp.renesas.com> Cheers, Biju > --- > kernel/bpf/memalloc.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/kernel/bpf/memalloc.c b/kernel/bpf/memalloc.c index > aad558cdc70f..0ad175277f89 100644 > --- a/kernel/bpf/memalloc.c > +++ b/kernel/bpf/memalloc.c > @@ -491,6 +491,13 @@ static int check_obj_size(struct bpf_mem_cache *c, > unsigned int idx) > struct llist_node *first; > unsigned int obj_size; > > + /* For per-cpu allocator, the size of free objects in free list > doesn't > + * match with unit_size and now there is no way to get the size of > + * per-cpu pointer saved in free object, so just skip the checking. > + */ > + if (c->percpu_size) > + return 0; > + > first = c->free_llist.first; > if (!first) > return 0; > -- > 2.29.2
Hello: This patch was applied to bpf/bpf.git (master) by Alexei Starovoitov <ast@kernel.org>: On Wed, 13 Sep 2023 21:59:43 +0800 you wrote: > From: Hou Tao <houtao1@huawei.com> > > For global per-cpu allocator, the size of free object in free list > doesn't match with unit_size and now there is no way to get the size of > per-cpu pointer saved in free object, so just skip the checking. > > Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> > Closes: https://lore.kernel.org/bpf/20230913133436.0eeec4cb@canb.auug.org.au/ > Signed-off-by: Hou Tao <houtao1@huawei.com> > > [...] Here is the summary with links: - [bpf] bpf: Skip unit_size checking for global per-cpu allocator https://git.kernel.org/bpf/bpf/c/dca7acd84e93 You are awesome, thank you!
diff --git a/kernel/bpf/memalloc.c b/kernel/bpf/memalloc.c index aad558cdc70f..0ad175277f89 100644 --- a/kernel/bpf/memalloc.c +++ b/kernel/bpf/memalloc.c @@ -491,6 +491,13 @@ static int check_obj_size(struct bpf_mem_cache *c, unsigned int idx) struct llist_node *first; unsigned int obj_size; + /* For per-cpu allocator, the size of free objects in free list doesn't + * match with unit_size and now there is no way to get the size of + * per-cpu pointer saved in free object, so just skip the checking. + */ + if (c->percpu_size) + return 0; + first = c->free_llist.first; if (!first) return 0;