From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-176.mta1.migadu.com (out-176.mta1.migadu.com [95.215.58.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6B1711F099C for ; Fri, 31 Jul 2026 05:19:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.176 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785475158; cv=none; b=MNbpx7Gfea950mh0Nj+OLWr1BgIXNWlBCRmwRPXSKx2a/vU5Yd9YA9AikN3hC1hgkBx4qDmRXPUmu64jze2+3gnAv6RdFy5g2UA7kIQ71Y7zdpkEfhzT+ZfiWKcjo4eUhHv+JVnTZxONIVgrm2mtmBWXlIU+UjFZe6KMfH6pbA0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785475158; c=relaxed/simple; bh=Xl40XVAbl5/NEfxk8jBsC+ldmXn8QF0CTbVLOG5vVak=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=hjJen1hOzBR66hyQpj2pN2KQkn6IHxlbvfLCTS2DLn2IXClYE1gJZFuYv8CwkaPaT/UeU4tSlV5pHKY6Pkxd6qarS5OCfZS4e6CTyHgmBaBOyhHyOdiJbsDWmdUlNrAD+X1yw3FGKQMb/BZx8sT5wreJAHy1TO6yLWl2YVJni7U= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=hk8TxX8i; arc=none smtp.client-ip=95.215.58.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="hk8TxX8i" Message-ID: <6ccbcd6b-ef0e-41d8-a5a4-80b7e94c7fd6@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1785475143; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9w+5s7rfo24271BZftg+qqsMB69AhQoZJfr2nqQsJY4=; b=hk8TxX8izVpu5swD9haQQPntp1QZZfKasPOxoobkBvtgc2AiqrKhl4/xBr+Bh42EwAqOxA qk0BQldKNcFoTnrPh89FrLaOOGMEyrJWK2Ngm3J+RE3/QGNDtTPlWg9HiNr0/uEjREoO1B Rp2CBsnl5rTWQeOxUbapFfEJ7Fca39A= Date: Fri, 31 Jul 2026 13:18:40 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [RFC PATCH bpf-next 1/6] bpf: Optimize string scan kfuncs To: Andrii Nakryiko Cc: bpf@vger.kernel.org, Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Eduard Zingerman , Kumar Kartikeya Dwivedi , Martin KaFai Lau , Song Liu , Yonghong Song , Jiri Olsa , Emil Tsalapatis , Ihor Solodrai , Shuah Khan , Rong Tao , Yuzuki Ishiyama , Viktor Malik , linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org References: <20260728145727.45153-1-leon.hwang@linux.dev> <20260728145727.45153-2-leon.hwang@linux.dev> Content-Language: en-US X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Leon Hwang In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT On 31/7/26 07:17, Andrii Nakryiko wrote: > On Tue, Jul 28, 2026 at 7:58 AM Leon Hwang wrote: [...] >> + >> + if (char_at <= zero_at) >> + return pos + char_at; >> + return nul_is_match ? pos + zero_at : -ENOENT; >> + }), err_out); > > looking at the above code, I'd say it's just not worth it. Too much > code and complexity, IMO. For the absolute majority of BPF programs > this small speed up won't matter, while for those BPF programs where > doing tons of bpf_strstr-like operations is the essence of those > programs and has a huge impact on the performance, they can basically > implement and maintain this complexity in their own code base. > Agreed on the complexity concern. Let's leave the str kfuncs as-is. Thanks, Leon >> + >> + return pos == XATTR_SIZE_MAX ? -E2BIG : -ENOENT; >> + >> +err_out: >> + return -EFAULT; >> +} >> + > > [...]