[PATCH bpf-next v2 1/3] bpf, arm64: Simplify if logic in emit_lse_atomic()

Xu Kuohai xukuohai at huaweicloud.com
Sun Jan 5 22:42:55 PST 2025


On 1/3/2025 10:02 AM, Peilin Ye wrote:
> Delete that unnecessary outer if clause.  No functional change.
> 
> Signed-off-by: Peilin Ye <yepeilin at google.com>
> ---
>   arch/arm64/net/bpf_jit_comp.c | 18 ++++++++----------
>   1 file changed, 8 insertions(+), 10 deletions(-)
> 
> diff --git a/arch/arm64/net/bpf_jit_comp.c b/arch/arm64/net/bpf_jit_comp.c
> index 66708b95493a..9040033eb1ea 100644
> --- a/arch/arm64/net/bpf_jit_comp.c
> +++ b/arch/arm64/net/bpf_jit_comp.c
> @@ -648,16 +648,14 @@ static int emit_lse_atomic(const struct bpf_insn *insn, struct jit_ctx *ctx)
>   	const s16 off = insn->off;
>   	u8 reg = dst;
>   
> -	if (off || arena) {
> -		if (off) {
> -			emit_a64_mov_i(1, tmp, off, ctx);
> -			emit(A64_ADD(1, tmp, tmp, dst), ctx);
> -			reg = tmp;
> -		}
> -		if (arena) {
> -			emit(A64_ADD(1, tmp, reg, arena_vm_base), ctx);
> -			reg = tmp;
> -		}
> +	if (off) {
> +		emit_a64_mov_i(1, tmp, off, ctx);
> +		emit(A64_ADD(1, tmp, tmp, dst), ctx);
> +		reg = tmp;
> +	}
> +	if (arena) {
> +		emit(A64_ADD(1, tmp, reg, arena_vm_base), ctx);
> +		reg = tmp;
>   	}
>   
>   	switch (insn->imm) {

Thanks for the improvements.

For the series:

Acked-by: Xu Kuohai <xukuohai at huawei.com>




More information about the linux-arm-kernel mailing list