From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-dy1-f180.google.com (mail-dy1-f180.google.com [74.125.82.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B94DB34D929 for ; Mon, 25 May 2026 18:14:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.180 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779732872; cv=none; b=ZEI6tb0RoxhJCiCwQLss7OYA/nlyKJnN3u4NQilzA7KfhYSfU/xGxpDSAJsbkmKnwC4UEDrERvXqovJ4FHh4ntoYqGUU6zc2gIJqfcnBlYB5B7IZZWIsuuRWnC/0xphqIQ+ebJEo+sYZWq/xEiCBKMMkoqP5DdYQbe5N8mvxA4Q= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779732872; c=relaxed/simple; bh=BpnA4XhIs5UtiDPdG52EaxYTy5pKl/uv/3Nd4jsFLsg=; h=Mime-Version:Content-Type:Date:Message-Id:Subject:From:To:Cc: References:In-Reply-To; b=m9U7/LbzVsly/O4kNtPOOznQQxcQvKNa/TemCWQmWmHZdeLfLc68ER5WB/CDqhntj9XM9gMt/Km7RpZzr/Twhe8YtalG+kgrgTK0Zq9BoF7Fp9YpgTXTZBQV6B54caRXeaLwrVkAjwrpuFl7ItxhuH78gv38C7uStjpSAplqnWM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=etsalapatis.com; spf=pass smtp.mailfrom=etsalapatis.com; dkim=pass (2048-bit key) header.d=etsalapatis-com.20251104.gappssmtp.com header.i=@etsalapatis-com.20251104.gappssmtp.com header.b=Wucafnwi; arc=none smtp.client-ip=74.125.82.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=etsalapatis.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=etsalapatis.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=etsalapatis-com.20251104.gappssmtp.com header.i=@etsalapatis-com.20251104.gappssmtp.com header.b="Wucafnwi" Received: by mail-dy1-f180.google.com with SMTP id 5a478bee46e88-3044857f09aso4895846eec.1 for ; Mon, 25 May 2026 11:14:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=etsalapatis-com.20251104.gappssmtp.com; s=20251104; t=1779732870; x=1780337670; darn=vger.kernel.org; h=in-reply-to:references:cc:to:from:subject:message-id:date :content-transfer-encoding:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=yvdS4aX6gI9MEHBOaVRe7PnOJQUK7bdoDGLJ+oujsnM=; b=WucafnwiipiBAy5KX0BdL2AdnNPnISex7+VEW33G3dXeGfJA2DsHD1MVyTcYK6qqLw iavzrrch2ugkzgMzqDSrjIq8RskX43kbi7OUF/4grLXNtdDkiiU4Crjk7y2hWtESP6Og 8+gGISm7s75Pq76puDwTa8vUBsBPuT26/OGdU4dvRqq98Z3DZqZdAuD9z1p+xtFRnWho KcjFK6gLsCa7uc1TFD15g52RgEeTsSIeHdTkoZSal5s4gppWAaoGWJqKu/9YcZbrHQEl rHC5S/+CF6HP2C5giuNVPCijYsMjIWPa/2EC2R4JEiq0sLt9hjdHl4N/s7biSKODDKGq FcdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779732870; x=1780337670; h=in-reply-to:references:cc:to:from:subject:message-id:date :content-transfer-encoding:mime-version:x-gm-gg:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=yvdS4aX6gI9MEHBOaVRe7PnOJQUK7bdoDGLJ+oujsnM=; b=TyK95rcBuQK1opezGdb5BGk+qM80N8jqOwvIHINQ19lZVQ0ag6hfG8DdLAgV1jE9Uf AEKch2OSohBjRwHRa5GcNmE5dKRBpWEaaTsnvf/EIqpGtFtkFaBHlO+K6cFOIfkN22ly qnflP/j47OhAV4NgfbNxDwUxWgRU3wO4jyxicAVdvYjsI5OPMWh0PImntL/N47TshvrX QvDLx6HPeXokV7yWXTiisCJtNTsebtClLWNx0XqI+oKhFsz8w4d19Sozf0yjmrgh7KYB DjUZUV0GyIjEIYCnXJsYxTAclvQ7gBO+IQJfjT2JlYcWzWMDHIM7dtIXcVchfDohiRLZ /NjA== X-Gm-Message-State: AOJu0YxXgBNf9Ts4Lie8XWGQ3tAdTv1dBID75SkafxITn8KPV9zUsDYY Xq+caiUkGbFQtsi2/WFR6m0SdbLwpZfliCxayYJHsAIl1r+87Lps+Dq/G3YFYSs5c8E= X-Gm-Gg: Acq92OGmgOe7dl6QaQ3GAfa2oOTYcJm5vspNSaWrJs2N9QapD5/bFPAzNDl/b2quv5P rv963bPtpvzBSiZ93cE8RIehtje3fn35buRU5R07UKLS4woIHH/iCTvITc+m1KQr5jajlIhQK2H bn+XZ9b5qdsout7AdR0SCWNM9Ql+N74aAqGhcOMV5NS6NZY0os7wKqvhyAg6uWE/mDtQgEMKCqP t5nU6teo5/i2pTKnKxsY1hwMi4UVsW0ONC2sT9hfSV7uqMPUyH8+kBJq6Yo5SBoXjk5a4j4/dQq Ann/trONpwW5PLbqUgRlBmGJhbGv/+Il5poZUMt61kMs6pKrrPduazf1KcFrAt7kVXl7gj/NK9g pHYjyFCp3SNhMcPDWu2gPlYOWurL1z1+n34KZIFDk8XT3H8Nv6wr+2Zg3fTw/sptjP2ZGRfYLsf IY+oo6wqLMSUizqA== X-Received: by 2002:a05:7300:8b14:b0:304:8361:a87e with SMTP id 5a478bee46e88-3048361afcdmr2512662eec.33.1779732869747; Mon, 25 May 2026 11:14:29 -0700 (PDT) Received: from localhost ([2620:10d:c090:600::cc2]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-30451ef470dsm8466985eec.4.2026.05.25.11.14.28 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 25 May 2026 11:14:29 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Mon, 25 May 2026 14:14:27 -0400 Message-Id: Subject: Re: [PATCH v2] bpf: replace pop/push emptiness check with bpf_list_empty() From: "Emil Tsalapatis" To: "Suchit Karunakaran" , , , , , , , , , , , Cc: X-Mailer: aerc 0.21.0-0-g5549850facc2 References: <20260524025853.13786-1-suchitkarunakaran@gmail.com> 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 > > Changes since v1: > - Removed unused variable node Saw v1 before v2: Reviewed-by: Emil Tsalapatis > --- > 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/tes= ting/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, s= truct 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; > =20 > bpf_spin_lock(lock); > - node =3D bpf_list_pop_front(head); > - if (node) { > - bpf_list_push_front(head, node); > - bpf_spin_unlock(lock); > - return false; > - } > + empty =3D bpf_list_empty(head); > bpf_spin_unlock(lock); > =20 > - return true; > + return empty; > } > =20 > /* flow->age is used to denote the state of the flow (not-detached, deta= ched, throttled)