From owner-freebsd-net Wed Mar 6 17:40:22 2002 Delivered-To: freebsd-net@freebsd.org Received: from rwcrmhc54.attbi.com (rwcrmhc54.attbi.com [216.148.227.87]) by hub.freebsd.org (Postfix) with ESMTP id 81C4437B416; Wed, 6 Mar 2002 17:40:08 -0800 (PST) Received: from InterJet.elischer.org ([12.232.206.8]) by rwcrmhc54.attbi.com (InterMail vM.4.01.03.27 201-229-121-127-20010626) with ESMTP id <20020307014008.UBOB1214.rwcrmhc54.attbi.com@InterJet.elischer.org>; Thu, 7 Mar 2002 01:40:08 +0000 Received: from localhost (localhost.elischer.org [127.0.0.1]) by InterJet.elischer.org (8.9.1a/8.9.1) with ESMTP id RAA38997; Wed, 6 Mar 2002 17:28:28 -0800 (PST) Date: Wed, 6 Mar 2002 17:28:27 -0800 (PST) From: Julian Elischer To: Terry Lambert Cc: net@freebsd.org, hackers@freebsd.org Subject: Re: in_pcblookup_hash() called multiple times In-Reply-To: <3C86BD6B.3ADCB4F0@mindspring.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org sounds good.. can you send us a patch to look at? On Wed, 6 Mar 2002, Terry Lambert wrote: > There are redundant calls to the in_pcblookup_hash() in the > ip_fw_chk() function called via (*ip_fw_chk_ptr)() in the > ip_input path. > > Would it be useful to modify the (*pr_input) function pointer > in the struct ipprotosw to take a fourth argument (perhaps it > should be cast to a "void *" to keep it generalized?) to pass > the pre-looked-up struct inpcb * to TCP, if the lookup has > already been done? > > Profiling indicates that this is one of the most expensive > calls in the code path, particularly when there are a lot > of sockets open. Increasing the hash table size only works > so far; at "a lot", the number of connections makes the > lookup expensive anyway (it's a linear traversal of the > collision chain for the bucket). > > Since there are reasons other than firewalling to do the > lookup early, it seems that it would be useful to pass a > pointer the a pointer that was non-NULL, if the lookup had > already taken place. For example, moving the ipflow to > use an overlay structure for the inpcb would mean that a > single lookup was used for fast forwarding, firewalling, > and inpcb identification for tcpcb retrieval for TCP. > > Note that I'm only talking about the packet input path here, > at this time, so the firewall code isn't really generalizable > (the inpcb is already known on output, except to the ip_fw > code; it probably doesn't make sense to push knwledge of it > into the ip_output path, at least without more thought). > > Right now, I'm just talking about a way ip_input could pass > the already looked up input inpcb to tcp_input, udp_input, > or udp_ctlinput -- all of which repeat the lookup operation. > > -- Terry > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-net" in the body of the message > To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message