From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-dl1-f43.google.com (mail-dl1-f43.google.com [74.125.82.43]) (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 4541639769A for ; Wed, 13 May 2026 22:35:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.43 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778711750; cv=none; b=Z+MRHD5wXGElkqJA3Ij3Pms6/zMcNmMb0JtLIbwBv9GlS1k5EWIlLjfo7B3GqdklMY2ixIa+IOiV/QCIQuA9FxSG1f42CWti9rANpDWLh+8q1iFOcvCt6DKEDnlgjoBj/6t8jq4byjrnQyJp2Sw9+P9Mn5oQyze9v6V9ChBqOfI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778711750; c=relaxed/simple; bh=gUrd+2r+CJ3+MIRtHvFv8bVXhWR3+Vlfirm5NflKs/I=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=JKfeBsm6D7QQh+0TooCZ/qUZXFdFRfzSzuMsNP+ddY17Gx28Q0YoMkJuf1+KgYQZ1f7lNeslMABOlUDGtAHZFPxsiVbggIkv1XrHAN2Fclfk4o6sCJgTruDG5inN+SMf0FbdUlz3+cGLJZS+JimqaF+MS5AWKHdnuRRiYc9TLZ0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=c1W/x9tk; arc=none smtp.client-ip=74.125.82.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="c1W/x9tk" Received: by mail-dl1-f43.google.com with SMTP id a92af1059eb24-134ac81c445so1308638c88.1 for ; Wed, 13 May 2026 15:35:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1778711748; x=1779316548; darn=vger.kernel.org; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:from:to:cc:subject :date:message-id:reply-to; bh=gUrd+2r+CJ3+MIRtHvFv8bVXhWR3+Vlfirm5NflKs/I=; b=c1W/x9tkJXXj98dkUCkQpcbm8AOT1+681olav2PXe7F14Sp/82tzsA5eOJhRBiSxT9 1c5NGZyNAbhVtt1xAGmLHK1dmJGjel5NLYeJbYSxyUGQxsz875l35/mw7hb1JDtyVByh L+1G4MhEcfQsxglyRX1S4ZW/x9ZKPJExHubcPlal88hfUBJV16Pc2IlMYgGhT7P0j37q Madw4ZPj5JaaA9w3vGAMPC+jP0LDpWyYXEhaNKD5tL5La4YZ5RzjZAygPILSRLyv/tZh e3G4DwVSBvXoM7HeGq48S5JO4YU2U2f2sGdkAvMaXggJyqsJjW+o9pM/V7P97FL1WZf4 sOXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778711748; x=1779316548; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=gUrd+2r+CJ3+MIRtHvFv8bVXhWR3+Vlfirm5NflKs/I=; b=IDDUbtlsLzf9oMDFwRsZS3AcLUqUIaHbQtGApy0LsmP+81u8lKIlu68MKQxIO1zK2t VDjKAy4VP8Imj5lY8+poke7XanBcgARt9f8Qg0y5ASBzctauaCOfztrAOeenVxxiUub+ hua7vX/p5wJ9164/LOVuALcWjCtXDVzR7sMcBeIQYnZDJsZUjHcx4GcdI44VMYlbc938 rEMm9foxvYfTl2QVlo+DxFTRBWCaQvAwKp+WzobER/6S4pPDRyI0qRAqtikRylOuZUb/ TE4w+cK1nRgigCgZbYfsDkeUy6EzApeet4WF5uS6UQQ809T1E/VQDnSyJNoeMQDEoNKO jg/Q== X-Forwarded-Encrypted: i=1; AFNElJ9HcufZKOsZ/3lpKy6S/VnbsLLxi+qvgxJJM/NYd+tvnbdd+yx8k34CzsxYwe2Ct5jAIRDqgDVmhtcV1yg=@vger.kernel.org X-Gm-Message-State: AOJu0YyBIsgJ+a5YD0yIHbnDhsva4yyOhsaT2K4pA3+/0/3e/qfdDWj3 6WdeqWwPZ/hzRHY6tRY6YpzRriksUxvgF26Qa6xNUz5oMLcyYjN1DTnE X-Gm-Gg: Acq92OEzJww1yOuHda7NJ3sTtKK/qrAI849HAY6zntYn61/wqN6aCYi5I+3nRJmyEIF l2Ogtt1498DzlUjB+BdnKGnaPrEvIkzqZqZfxmFbl1Ypygu9kmqfxxvs7nlvfPs3r/xIg7onpls W060PGCSt2JBFAEy6FTJ95kJ71lg5ongwy/+P7kkf0CzmfLy9Q1gug+VAFqswBLuqJKCtO+pOuz weimMRf+S4aC8zcxTzfSXDZ4S09VbvjdGkn1D5yFGHp6BMcE0CVV4qD3FpnFS4bJ3Yb/8ngnEp0 C6gopOZ5hBuJqNgxW3FXwTBN4fqY/1C/YPacnfT/7QoK2rKH2+XJaC9Lmyt/iwckDVT7gOnbAyb 3J+XI1f1ynxgS8dIpa91GRdSCIyzk4bnYC6xJC1a7FQOZ8hkdFcrEhCEDmnQL0IPv7yNAH6VrT8 xmFkxPfg+7E3n3GroKM67rytkmIXGDPPBE8qTWwIp4j0Uy7JE4JKIhUd+q+F///ezJFglCCwKzN uKI5xY= X-Received: by 2002:a05:7022:4582:b0:128:d51a:5161 with SMTP id a92af1059eb24-1343699b60dmr3654904c88.27.1778711748302; Wed, 13 May 2026 15:35:48 -0700 (PDT) Received: from ?IPv6:2a03:83e0:115c:1:5152:641f:f5ef:6c7b? ([2620:10d:c090:500::2:8a9]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-134cbcb93f3sm1371607c88.3.2026.05.13.15.35.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 May 2026 15:35:48 -0700 (PDT) Message-ID: Subject: Re: [PATCH RESEND bpf-next v10 6/8] bpf: add bpf_list_is_first/last/empty kfuncs From: Eduard Zingerman To: Kaitao cheng , ast@kernel.org, corbet@lwn.net, martin.lau@linux.dev, daniel@iogearbox.net, andrii@kernel.org, song@kernel.org, yonghong.song@linux.dev, john.fastabend@gmail.com, kpsingh@kernel.org, sdf@fomichev.me, haoluo@google.com, jolsa@kernel.org, shuah@kernel.org, chengkaitao@kylinos.cn, skhan@linuxfoundation.org, memxor@gmail.com Cc: bpf@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, vmalik@redhat.com, linux-kselftest@vger.kernel.org, Emil Tsalapatis Date: Wed, 13 May 2026 15:35:45 -0700 In-Reply-To: <20260512055919.95716-7-kaitao.cheng@linux.dev> References: <20260512055919.95716-1-kaitao.cheng@linux.dev> <20260512055919.95716-7-kaitao.cheng@linux.dev> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.58.3 (3.58.3-1.fc43) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 On Tue, 2026-05-12 at 13:59 +0800, Kaitao cheng wrote: > From: Kaitao Cheng >=20 > Add three kfuncs for BPF linked list queries: > - bpf_list_is_first(head, node): true if node is the first in the list. > - bpf_list_is_last(head, node): true if node is the last in the list. > - bpf_list_empty(head): true if the list has no entries. >=20 > Currently, without these kfuncs, to implement the above functionality > it is necessary to first call bpf_list_pop_front/back to retrieve the > first or last node before checking whether the passed-in node was the > first or last one. After the check, the node had to be pushed back into > the list using bpf_list_push_front/back, which was very inefficient. >=20 > Now, with the bpf_list_is_first/last/empty kfuncs, we can directly > check whether a node is the first, last, or whether the list is empty, > without having to first retrieve the node. >=20 > Signed-off-by: Kaitao Cheng > Reviewed-by: Emil Tsalapatis > --- Reviewed-by: Eduard Zingerman [...]