Index | Thread | Search

From:
Vitaliy Makkoveev <otto@bsdbox.dev>
Subject:
Re: running TCP input in parallel
To:
Alexander Bluhm <bluhm@openbsd.org>
Cc:
tech@openbsd.org
Date:
Sat, 26 Apr 2025 16:28:30 +0300

Download raw body.

Thread
> On 26 Apr 2025, at 01:12, Alexander Bluhm <bluhm@openbsd.org> wrote:
> 
> On Thu, Apr 17, 2025 at 06:53:19PM +0200, Alexander Bluhm wrote:
>> I have several positive test reports.
> 
> Mark Patruck has seen some connection errors in his zabbix monitor.
> He was using the diff which caches the TCP socket lock.
> 
> With the simpler diff below these sporadic failures do not occur.
> 
> So I would suggest enabling simple prallel input first.  Throughput
> optimization can be done later.  Let's see if tcp_input() is really
> MP safe.
> 
> ok?
> 

sure

> bluhm
> 
> Index: netinet/in_proto.c
> ===================================================================
> RCS file: /data/mirror/openbsd/cvs/src/sys/netinet/in_proto.c,v
> diff -u -p -r1.121 in_proto.c
> --- netinet/in_proto.c	5 Jan 2025 12:36:48 -0000	1.121
> +++ netinet/in_proto.c	25 Apr 2025 10:36:56 -0000
> @@ -197,7 +197,8 @@ const struct protosw inetsw[] = {
>   .pr_type	= SOCK_STREAM,
>   .pr_domain	= &inetdomain,
>   .pr_protocol	= IPPROTO_TCP,
> -  .pr_flags	= PR_CONNREQUIRED|PR_WANTRCVD|PR_ABRTACPTDIS|PR_SPLICE,
> +  .pr_flags	= PR_CONNREQUIRED|PR_WANTRCVD|PR_ABRTACPTDIS|PR_SPLICE|
> +		    PR_MPINPUT,
>   .pr_input	= tcp_input,
>   .pr_ctlinput	= tcp_ctlinput,
>   .pr_ctloutput	= tcp_ctloutput,
> Index: netinet6/in6_proto.c
> ===================================================================
> RCS file: /data/mirror/openbsd/cvs/src/sys/netinet6/in6_proto.c,v
> diff -u -p -r1.124 in6_proto.c
> --- netinet6/in6_proto.c	5 Jan 2025 12:36:48 -0000	1.124
> +++ netinet6/in6_proto.c	25 Apr 2025 10:36:56 -0000
> @@ -147,7 +147,8 @@ const struct protosw inet6sw[] = {
>   .pr_type	= SOCK_STREAM,
>   .pr_domain	= &inet6domain,
>   .pr_protocol	= IPPROTO_TCP,
> -  .pr_flags	= PR_CONNREQUIRED|PR_WANTRCVD|PR_ABRTACPTDIS|PR_SPLICE,
> +  .pr_flags	= PR_CONNREQUIRED|PR_WANTRCVD|PR_ABRTACPTDIS|PR_SPLICE|
> +		    PR_MPINPUT,
>   .pr_input	= tcp_input,
>   .pr_ctlinput	= tcp6_ctlinput,
>   .pr_ctloutput	= tcp_ctloutput,
>