Re: [RFC PATCH bpf-next 02/12] bpf: Simplify reg0 marking for the rbtree kfuncs that return a bpf_rb_node pointer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, 19 Apr 2025 at 00:47, Martin KaFai Lau <martin.lau@xxxxxxxxx> wrote:
>
> From: Martin KaFai Lau <martin.lau@xxxxxxxxxx>
>
> The current rbtree kfunc, bpf_rbtree_{first, remove}, returns the
> bpf_rb_node pointer. The check_kfunc_call currently checks the
> kfunc btf_id instead of its return pointer type to decide
> if it needs to do mark_reg_graph_node(reg0) and ref_set_non_owning(reg0).
>
> The later patch will add bpf_rbtree_{root,left,right} that will also
> return a bpf_rb_node pointer. Instead of adding more kfunc btf_id
> checks to the "if" case, this patch changes the test to check the
> kfunc's return type. is_rbtree_node_type() function is added to
> test if a pointer type is a bpf_rb_node. The callers have already
> skipped the modifiers of the pointer type.
>
> A note on the ref_set_non_owning(), although bpf_rbtree_remove()
> also returns a bpf_rb_node pointer, the bpf_rbtree_remove()
> has the KF_ACQUIRE flag. Thus, its reg0 will not become non-owning.
>
> Signed-off-by: Martin KaFai Lau <martin.lau@xxxxxxxxxx>
> ---

Acked-by: Kumar Kartikeya Dwivedi <memxor@xxxxxxxxx>




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux