public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Benjamin LaHaise <bcrl@redhat.com>
To: "David S. Miller" <davem@redhat.com>
Cc: ak@muc.de, sim@netnation.com, linux-kernel@vger.kernel.org
Subject: Re: Awfully slow /proc/net/tcp, netstat, in.identd in 2.4 (updated)
Date: Fri, 19 Oct 2001 18:04:34 -0400	[thread overview]
Message-ID: <20011019180433.H9206@redhat.com> (raw)
In-Reply-To: <k23d4fwkv6.fsf@zero.aec.at> <20011019.135924.112609345.davem@redhat.com> <20011019173055.G9206@redhat.com> <20011019.145639.59667516.davem@redhat.com>
In-Reply-To: <20011019.145639.59667516.davem@redhat.com>; from davem@redhat.com on Fri, Oct 19, 2001 at 02:56:39PM -0700

On Fri, Oct 19, 2001 at 02:56:39PM -0700, David S. Miller wrote:
> It doesn't need to "fit in the cache" to perform optimally, that's
> a load of crap Ben.
> 
> I actually tested this, and in fact on a cpu that has a meager 512K
> cache at the time, and it did turn out to be more important to keep
> the hash chains short than to keep it fitting in the cache.
> 
> So please don't give me any crap about "fitting in the cache" unless
> you can show me hard numbers that show that it does in fact perform
> worse.

Okay, let's take a look at the case where I have 64 connections open: if 
I'm using a 64 entry hash table with one 4 byte pointer per entry and 
perfect hashing, then it has a cache footprint of 256 bytes.  Max.  Now, 
the same hash table blown up to 4MB is going to have a cache footprint 
of 64 bytes (1 cache line) per entry, for a total of a 4KB cache footprint.
Which is better?

> Let me clue you in.  If the hash chains get long, you (instead of
> cache missing on the table itself) are missing the cache several
> times over walking the long hash chains.

Don't AssUMe that I don't realise this.  What I'm saying is that a 4MB hash 
table for a system with a puny number of connections is bloat.  Needless 
bloat.  4MB is enough memory for a copy of gcc.  Or enough to run 4 shells.  
If the hash table was grown dynamically, I wouldn't have this complaint.

		-ben

  reply	other threads:[~2001-10-19 22:04 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-10-18 16:42 Awfully slow /proc/net/tcp, netstat, in.identd in 2.4 (updated) Simon Kirby
2001-10-18 16:49 ` David S. Miller
2001-10-18 17:05   ` Simon Kirby
2001-10-19 12:57 ` Andi Kleen
2001-10-19 15:59   ` Simon Kirby
2001-10-19 18:22     ` Andi Kleen
2001-10-19 20:59       ` David S. Miller
2001-10-19 21:30         ` Benjamin LaHaise
2001-10-19 21:56           ` David S. Miller
2001-10-19 22:04             ` Benjamin LaHaise [this message]
2001-10-19 22:11               ` David S. Miller
2001-10-19 22:13                 ` Benjamin LaHaise

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20011019180433.H9206@redhat.com \
    --to=bcrl@redhat.com \
    --cc=ak@muc.de \
    --cc=davem@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sim@netnation.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox