Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 6 Mar 2002 17:28:27 -0800 (PST)
From:      Julian Elischer <julian@elischer.org>
To:        Terry Lambert <tlambert2@mindspring.com>
Cc:        net@freebsd.org, hackers@freebsd.org
Subject:   Re: in_pcblookup_hash() called multiple times
Message-ID:  <Pine.BSF.4.21.0203061728090.37321-100000@InterJet.elischer.org>
In-Reply-To: <3C86BD6B.3ADCB4F0@mindspring.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0203061728090.37321-100000>