Article View: linux.kernel.netdev
Article #13669Re: [PATCH net] selftests: net: udpgso_bench_tx: honor CPU zero in the affinity option
From: Hangbin Liu
Date: Tue, 10 Nov 2026 06:26
Date: Tue, 10 Nov 2026 06:26
41 lines
9816 bytes
9816 bytes
On Tue, Nov 10, 2026 at 03:39:20AM +0000, Jingjing Xu wrote:
> The -C option accepts a CPU number, with -1 meaning that affinity was
> not requested. Testing cfg_cpu > 0 ignores an explicit -C 0, so the
> benchmark can run on other CPUs despite the requested pinning.
>
> Accept zero as well, keeping the negative default unchanged.
>
> Discovered by Codex-assisted code inspection. Validated before and after
> the fix with loopback UDP traffic, inheriting CPUs 0 and 1 and reading
> the process affinity with sched_getaffinity(). Before the fix, -C 0
> retains both CPUs; after it, only CPU 0 is allowed. The default and -C 1
> cases retain their expected masks. Built with GCC using -Wall -Werror.
>
> No kernel instrumentation or fault injection was used.
>
> Fixes: 3a687bef148d ("selftests: udp gso benchmark")
> Signed-off-by: Jingjing Xu <xujingjing@cmss.chinamobile.com>
> ---
> tools/testing/selftests/net/udpgso_bench_tx.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/net/udpgso_bench_tx.c b/tools/testing/selftests/net/udpgso_bench_tx.c
> index 86d80cce55b4..797c8d6800f0 100644
> --- a/tools/testing/selftests/net/udpgso_bench_tx.c
> +++ b/tools/testing/selftests/net/udpgso_bench_tx.c
> @@ -642,7 +642,7 @@ int main(int argc, char **argv)
>
> parse_opts(argc, argv);
>
> - if (cfg_cpu > 0)
> + if (cfg_cpu >= 0)
> set_cpu(cfg_cpu);
>
> for (i = 0; i < sizeof(buf[0]); i++)
> base-commit: 30c71476d842b094651bd7712f6c8ee8716147d0
> --
> 2.53.0
>
Reviewed-by: Hangbin Liu <liuhangbin@kylinos.cn>
Technical Details
Message-ID:
<avK5BTH-n4hHIb4_@fedora>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-359911-linux-kernel-netdev=dewy.ruReferences:
<20261110033920.49267-1-xujingjing@cmss.chinamobile.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-359911-linux-kernel-netdev=dewy.ru From: hangbin.liu@linux.dev (Hangbin Liu) Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net] selftests: net: udpgso_bench_tx: honor CPU zero in the affinity option Date: Tue, 10 Nov 2026 14:26:13 +0800 Organization: Usenet Network Message-ID: <avK5BTH-n4hHIb4_@fedora> References: <20261110033920.49267-1-xujingjing@cmss.chinamobile.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: usenet.network; logging-data="539099"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:Yp4tvdizKUmbpr5io1iDBCGkkE0= sha256:QSuSpTHqTdW7Z9IhFULMnpdtd7htuuK6SnZGtC0/HBg= sha1:Y+BFWpvSuA4w69OpuOcGWj9wVpo= sha256:ranNDVHQAPgtYiCl8PezhCjUWScVBdCazZe105Xow5A= Content-Disposition: inline List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 2AA41113A4F; Tue, 10 Nov 2026 09:30:23 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.05 X-Spam-Status: No, score=-3.05 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (1024-bit key) header.d=linux.dev X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id xcr67tAzCWBU; Tue, 10 Nov 2026 09:30:19 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-359911-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=linux.dev X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 4F28E113A4A; Tue, 10 Nov 2026 09:30:11 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id DED8FC5BE7; Tue, 10 Nov 2026 06:26:37 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1794291997; b=vl6rEsbbXIeodCXEhvfoyHm5WapomKDR3/4U131skBfAPiGrngIeMFnnUeXXpzeq64E2 1Jv6gYk9birgvc72zXQg3e4Y+A/IL1NQzIoYIMwsGWq2uLG1R+2TVnjAaPbim3YUUSrSu wnyatXWdX0aaBXt9XT2ZWRvnWrsGTceDbB+65oG/Cz2ynQ7uFVcEZ1PiD9zYj1jGk4L6i YYDODRUEadooHCtuUs3QMlXEC0RYox/+ufis0+mC819BhI+3DpeeJpPofcibcCU8OxUZe sWrXaNcZ5JRlvMn4A3IYvCXK/shHfn92JJ9k+mgFqheCqmAZB7RVmdQDsj8csecTLFg== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794291997; h=X-Original-To:Received:DMARC-Filter:X-Envelope-To:DKIM-Signature: X-Envelope-To:Received:X-Mizu-Trace-ID:X-Migadu-Flow:Date:From:To:Cc: Subject:Message-ID:References:X-Mailing-List:List-Id:List-Post: List-Help:List-Subscribe:List-Unsubscribe:List-Owner:Precedence: MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=ojUYDTL9NZGqTuzOAcNPqIkucjU3jwnh2aKBI9TK0GA=; b=hMFq4DnGhSlRev4e5F5oKDQlpPu6md19D/+Evral3XqI7T/0zntJdhsGUI+ki7fow5WX 3ctmlECrIi4X3GN/JlUAmP5QBbojkrZOczmzmu4FItvitmIdeD4P/l4TOaY667OhDVWhY Okp6uhtrdMapIGpZjcdTktpqp/+jkbFl3qi8301V6DHI4xYU7mHBF8310ZFavkn4rNS/Q Uet7Kjjl8mu3vW1cVn8OJElc6rfdaZe3aw5D7sgAhJgM72Eh57HebHlgL4Vwf+zzysQBW zbiU2657nANbT/eT/SNuHjZRslsuUfLKhKGGcEX+KxNzIYXxz942mGTQGLZYH0ICfkw== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=WdU61FaQ; dmarc=pass header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 37E7D606A332; Tue, 10 Nov 2026 06:26:37 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=WdU61FaQ X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=95.215.58.28 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1794291996; b=j8SL4SdkkRSjkxAC9KaRKyaJHmMxky9hXvw0TpHgBErTwBxgaiyo7iVtubQDwMJ0Hjge YxNYm+4xq+4cX2s1fqCi2lHrN+1QMgwneQwT6PVzsjudTI0aG7WSRUq9or53+ZYJTqPDQ Y17v2JBdq/GCZf2X9b8+Abr/kwym8EOS+EyHW5NoJQr8HLjieS8KaRiyYkXA09k61lmbb KDanxiCO6hlSE94Nqoo+n3cfQZw8bQMhbawb4u7NNnwy7/cCvUJaKMMS/O8Il/hxlAsV2 p/33qQQbWWxqGrqzsNIEG1AaUgqaaeozXliudbZ8kvruUklY79QcMqk0rGozigPo/Ow== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794291996; h=DMARC-Filter:X-Envelope-To:DKIM-Signature:X-Envelope-To:Received: X-Mizu-Trace-ID:X-Migadu-Flow:Date:From:To:Cc:Subject:Message-ID: References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=ojUYDTL9NZGqTuzOAcNPqIkucjU3jwnh2aKBI9TK0GA=; b=i1sBK49UUrwhrO9rKw7GwZCYltcs0qUq+ZzrWEol7DvCdVyeS0cK7Dd/O3eZyJLOxm+Z J2x3tvQwj/E9f34mxPWKtZJmo+z/RnU8yaMK3zvPTkYsf5KAxd6tveEVPJvibJgP5BoDW SXkHvBbSjf/30acM7aAR93ggZLlI2VhhH/BcfsWhfGfCo93FO6dzK9LwjxgxxHya/97zF l0myFMoxQ2QkhL3KpbIIANECrqUWowGvAbWqYLqVJ/6wWsX6ypGumFJS7SPoXgHTg5tmn SFxda4xhSab8qV02WdVzXEyhroD0w+NUqcyvYsVo0VV5GmRbbJPxqwl/DmvvWeeFqIA== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=WdU61FaQ; arc=none smtp.remote-ip=95.215.58.28 X-Received: from mta1.migadu.com (out-28.mta1.migadu.com [95.215.58.28]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 44261606A321 for <netdev@vger.kernel.org>; Tue, 10 Nov 2026 06:26:34 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 44261606A321 X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev X-Envelope-To: netdev@vger.kernel.org X-DKIM-Signature: a=rsa-sha256; bh=2HOEpaZ+eKTnq4zhEkTJPCUHP9kr5u1Ujd+ujWJoYoQ=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1794291992; v=1; x=1794896792; b=WdU61FaQHjjd+fNp26rLGbCEqgA5/u8zkoKZsSU1t1/zhTcptpk6SVuJ/554HaYq1dFsF/fZ hlyvEUXb1a67JBEwwIRsjpDXipInThcVHcM85eucGEsQpKU4/49cXf8x8EKMUgL5Ux23HSBkSNG zICfEJpoIGHTqAeSxwxzSoOU= X-Envelope-To: netdev@vger.kernel.org X-Received: by mta11.migadu.com with ESMTPS id 21ddd5e6cb307c28; Tue, 10 Nov 2026 06:26:31 +0000 X-Mizu-Trace-ID: 21ddd5e6cb307c28 X-Migadu-Flow: FLOW_OUT X-Cc: netdev@vger.kernel.org, willemb@google.com, kuba@kernel.org, shuah@kernel.org, linux-kselftest@vger.kernel.org, davem@davemloft.net, edumazet@kernel.org, pabeni@redhat.com, horms@kernel.org X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list X-In-Reply-To: <20261110033920.49267-1-xujingjing@cmss.chinamobile.com>