diff options
author | Andi Kleen <ak@suse.de> | 2008-08-28 01:08:02 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-08-28 01:08:02 -0700 |
commit | 6eac56040787c3ff604fe7d48bbbb7897cd1387c (patch) | |
tree | 1d3271c33d8d65bfea4aaf5d770f73ccd6da5825 /README | |
parent | 4d40555250320520c5398569457962b3984fc75e (diff) |
tcp: Skip empty hash buckets faster in /proc/net/tcp
On most systems most of the TCP established/time-wait hash buckets are empty.
When walking the hash table for /proc/net/tcp their read locks would
always be aquired just to find out they're empty. This patch changes the code
to check first if the buckets have any entries before taking the lock, which
is much cheaper than taking a lock. Since the hash tables are large
this makes a measurable difference on processing /proc/net/tcp,
especially on architectures with slow read_lock (e.g. PPC)
On a 2GB Core2 system time cat /proc/net/tcp > /dev/null (with a mostly
empty hash table) goes from 0.046s to 0.005s.
On systems with slower atomics (like P4 or POWER4) or larger hash tables
(more RAM) the difference is much higher.
This can be noticeable because there are some daemons around who regularly
scan /proc/net/tcp.
Original idea for this patch from Marcus Meissner, but redone by me.
Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'README')
0 files changed, 0 insertions, 0 deletions