From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-183.mta1.migadu.com (out-183.mta1.migadu.com [95.215.58.183]) (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 C0F7514A60F for ; Fri, 31 Jul 2026 05:19:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.183 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785475157; cv=none; b=ITkxU9r+B5AmOzcbji66alIh8/NqQhsLoFzgBRCtWAC3fOt67KalwjHsiZPj9mf6WoClH3Rbkn+7yz7dnlrmGlpgOzI9h9aOSdjJBxF3XwZ5BLIsJSBFrgLhTNifKVa6cTBjhMfDX448ydp69oMmcFInoyZ+8fMkddGdGmp66Z8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785475157; c=relaxed/simple; bh=Xl40XVAbl5/NEfxk8jBsC+ldmXn8QF0CTbVLOG5vVak=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=UQ28v90edheNnLAv9aos+dN6HLyDa3g/X973L+aLkJAQhZIBXfOrbI/NgSF/CVeX96sWdAsCRK+U1cojnobHtCajcnKI9ZkEq92mk2BozkewXjd7JLALnVzqdFsVH7N1IYaXA4Kf0sS7JrJ9PPRuSD7rUpEV0EQHVcxOho/cD9Q= 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.183 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-kselftest@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; >> +} >> + > > [...]