From owner-svn-src-user@FreeBSD.ORG Thu Mar 5 15:16:13 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 798831065700; Thu, 5 Mar 2009 15:16:13 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 37C4C8FC24; Thu, 5 Mar 2009 15:16:13 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (pool-98-109-39-197.nwrknj.fios.verizon.net [98.109.39.197]) by cyrus.watson.org (Postfix) with ESMTPSA id B8F5E46B39; Thu, 5 Mar 2009 10:16:12 -0500 (EST) Received: from localhost (john@localhost [127.0.0.1]) (authenticated bits=0) by server.baldwin.cx (8.14.3/8.14.3) with ESMTP id n25FG6sD004602; Thu, 5 Mar 2009 10:16:06 -0500 (EST) (envelope-from jhb@freebsd.org) From: John Baldwin To: Kip Macy Date: Thu, 5 Mar 2009 10:04:36 -0500 User-Agent: KMail/1.9.7 References: <200903042122.n24LMdO3053650@svn.freebsd.org> <200903041759.31535.jhb@freebsd.org> <3c1674c90903041520o145b0c42uc1dd2d41870432e6@mail.gmail.com> In-Reply-To: <3c1674c90903041520o145b0c42uc1dd2d41870432e6@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200903051004.36626.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [127.0.0.1]); Thu, 05 Mar 2009 10:16:06 -0500 (EST) X-Virus-Scanned: ClamAV 0.94.2/9073/Thu Mar 5 08:50:21 2009 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=4.2 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.1.3 X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on server.baldwin.cx Cc: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: Re: svn commit: r189374 - user/kmacy/HEAD_fast_net_merge/sys/netinet X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Mar 2009 15:16:13 -0000 On Wednesday 04 March 2009 6:20:55 pm Kip Macy wrote: > Do we have any mechanism for handling sparse cpuids? > If so I can do modulo the number of active cpus and then taking that > value as an index. If not its a bit of an academic observation. >=20 > -Kip The rest of the kernel is careful to handle sparse cpuids already. You can= =20 use CPU_ABSENT() to see if a CPU is present or not. You cound pre-populate= a=20 table during boot if you wished by doing something like: int active_cpus[MAXCPU]; sysinit_foo() { int i, cpu; i =3D 0; for (cpu =3D 0; cpu <=3D mp_maxid; cpu++) { if (CPU_ABSENT(cpu) continue; active_cpus[i] =3D cpu; i++; } KASSERT(i =3D=3D mp_ncpu, ("bad juju")); } Then you could use (active_cpus[flowid & mp_ncpu]) as a CPU. Eventually wh= en=20 we support removing and adding CPUs at runtime (or disabling/enabling them = at=20 runtime) there will be eventhandlers that you can hook to adjust your=20 active_cpus array. =20 > On Wed, Mar 4, 2009 at 2:59 PM, John Baldwin wrote: > > On Wednesday 04 March 2009 4:22:39 pm Kip Macy wrote: > >> Author: kmacy > >> Date: Wed Mar =A04 21:22:39 2009 > >> New Revision: 189374 > >> URL: http://svn.freebsd.org/changeset/base/189374 > >> > >> Log: > >> =A0 Use per-cpu callouts for tcp_timer > >> =A0 186694, 187660 > >> > >> =A0 186694: > >> =A0 - convert tcp_timer_activate over to using > >> =A0 =A0 per-cpu callouts > >> =A0 - don't acquire the tcbinfo lock exclusively > >> =A0 =A0 in tcp_timer_rexmt unless needed for tcp_drop > >> > >> =A0 187660: > >> =A0 - mp_maxid may not be valid ensure that we > >> =A0 =A0 re-schedule on cpuid less than or equal to > >> =A0 =A0 the current one for tcp callouts > >> > >> Modified: > >> =A0 user/kmacy/HEAD_fast_net_merge/sys/netinet/tcp_timer.c > >> > >> Modified: user/kmacy/HEAD_fast_net_merge/sys/netinet/tcp_timer.c > >> > >=20 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > >> --- user/kmacy/HEAD_fast_net_merge/sys/netinet/tcp_timer.c =A0 =A0Wed = Mar =A04 > > 21:04:52 2009 =A0 (r189373) > >> +++ user/kmacy/HEAD_fast_net_merge/sys/netinet/tcp_timer.c =A0 =A0Wed = Mar =A04 > > 21:22:39 2009 =A0 (r189374) > >> @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); > >> =A0#include > >> =A0#include > >> =A0#include > >> +#include > >> =A0#include > >> =A0#include > >> =A0#include > >> @@ -118,6 +119,8 @@ int =A0 =A0 =A0 tcp_maxpersistidle; > >> =A0 =A0 =A0 /* max idle time in persist */ > >> =A0int =A0tcp_maxidle; > >> > >> +#define =A0 =A0 =A0INP_CPU(inp) =A0 =A0min(curcpu, ((inp)->inp_flowid= % mp_maxid)) > > > > This is not really safe. =A0CPU ID's may be sparse. =A0The only guarant= ees you > > have are that 0 is the boot CPU, and that all valid CPU IDs are in the= =20 range > > [0 .. mp_maxid] (inclusive). =A0Thus, you could have a system that only= has > > CPUs 0 and 3 and if you are on CPU 3 and flowid is 5, then this will=20 choose > > min(3, 5 % 3) =3D=3D min(3, 2) =3D=3D 2 which is an invalid CPU. > > > > -- > > John Baldwin > > >=20 =2D-=20 John Baldwin