Fix an optimization where I made an ifdef'd out section to broad.

When the hostcache bucket limit is reached the last bucket wasn't
removed from the bucket row but inserted a few lines later at the
bucket row head again.  This leads to infinite loop when the same
bucket row is accessed the next time for a lookup/insert or purge
action.

Tested by:	imp, Matt Smith
Approved by:	re (rwatson)
This commit is contained in:
Andre Oppermann 2003-11-28 16:33:03 +00:00
parent dd8b0111cb
commit cd6c4060c8

View File

@ -351,16 +351,16 @@ tcp_hc_insert(struct in_conninfo *inc)
* At first we were dropping the last element, just to
* reaquire it in the next two lines again which ain't
* very efficient. Instead just reuse the least used element.
* maybe we drop something that is still "in-use" but we can
* Maybe we drop something that is still "in-use" but we can
* be "lossy".
*/
#if 0
TAILQ_REMOVE(&hc_head->hch_bucket, hc_entry, rmx_q);
uma_zfree(tcp_hostcache.zone, hc_entry);
tcp_hostcache.hashbase[hash].hch_length--;
tcp_hostcache.cache_count--;
#endif
tcpstat.tcps_hc_bucketoverflow++;
#if 0
uma_zfree(tcp_hostcache.zone, hc_entry);
#endif
} else {
/*
* Allocate a new entry, or balk if not possible