Linux Kernel Selftest development
 help / color / mirror / Atom feed
From: "Emil Tsalapatis" <emil@etsalapatis.com>
To: "Suchit Karunakaran" <suchitkarunakaran@gmail.com>,
	<andrii@kernel.org>, <eddyz87@gmail.com>, <ast@kernel.org>,
	<daniel@iogearbox.net>, <martin.lau@linux.dev>,
	<memxor@gmail.com>, <song@kernel.org>, <yonghong.song@linux.dev>,
	<shuah@kernel.org>, <bpf@vger.kernel.org>,
	<linux-kselftest@vger.kernel.org>
Cc: <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] bpf: replace pop/push emptiness check with bpf_list_empty()
Date: Mon, 25 May 2026 14:14:27 -0400	[thread overview]
Message-ID: <DIRYNC29TMEZ.2YIXO06OYS53W@etsalapatis.com> (raw)
In-Reply-To: <20260524025853.13786-1-suchitkarunakaran@gmail.com>

On Sat May 23, 2026 at 10:58 PM EDT, Suchit Karunakaran wrote:
> Simplify fq_flows_is_empty() by replacing the pop/push based emptiness
> check with a direct call to bpf_list_empty().
> This avoids unnecessary list mutation and simplifies the code while
> preserving correctness.
>
> Signed-off-by: Suchit Karunakaran <suchitkarunakaran@gmail.com>
>
> Changes since v1:
> - Removed unused variable node

Saw v1 before v2:

Reviewed-by: Emil Tsalapatis <emil@etsalapatis.com>

> ---
>  tools/testing/selftests/bpf/progs/bpf_qdisc_fq.c | 11 +++--------
>  1 file changed, 3 insertions(+), 8 deletions(-)
>
> diff --git a/tools/testing/selftests/bpf/progs/bpf_qdisc_fq.c b/tools/testing/selftests/bpf/progs/bpf_qdisc_fq.c
> index 1a3233a275c7..8107f5934d2d 100644
> --- a/tools/testing/selftests/bpf/progs/bpf_qdisc_fq.c
> +++ b/tools/testing/selftests/bpf/progs/bpf_qdisc_fq.c
> @@ -196,18 +196,13 @@ fq_flows_remove_front(struct bpf_list_head *head, struct bpf_spin_lock *lock,
>  static bool
>  fq_flows_is_empty(struct bpf_list_head *head, struct bpf_spin_lock *lock)
>  {
> -	struct bpf_list_node *node;
> +	bool empty;
>  
>  	bpf_spin_lock(lock);
> -	node = bpf_list_pop_front(head);
> -	if (node) {
> -		bpf_list_push_front(head, node);
> -		bpf_spin_unlock(lock);
> -		return false;
> -	}
> +	empty = bpf_list_empty(head);
>  	bpf_spin_unlock(lock);
>  
> -	return true;
> +	return empty;
>  }
>  
>  /* flow->age is used to denote the state of the flow (not-detached, detached, throttled)


  reply	other threads:[~2026-05-25 18:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-24  2:58 [PATCH v2] bpf: replace pop/push emptiness check with bpf_list_empty() Suchit Karunakaran
2026-05-25 18:14 ` Emil Tsalapatis [this message]
2026-05-29  3:10 ` patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DIRYNC29TMEZ.2YIXO06OYS53W@etsalapatis.com \
    --to=emil@etsalapatis.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=memxor@gmail.com \
    --cc=shuah@kernel.org \
    --cc=song@kernel.org \
    --cc=suchitkarunakaran@gmail.com \
    --cc=yonghong.song@linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox