Re: Multithreaded TCP/IP stack

From: Andi Kleen (ak@suse.de)
Date: Thu Jul 13 2000 - 17:45:29 EST


On Fri, Jul 14, 2000 at 07:30:56AM +1200, Chris Wedgwood wrote:
> On Thu, Jul 13, 2000 at 01:47:08PM -0400, Richard B. Johnson wrote:
>
> On Thu, 13 Jul 2000, Stephen Torri wrote:
>
> > A friend of mine is critical of linux for not having a
> > multithreaded TCP/IP stack. Is that true? If it is not then
> > what kernel version introduced it. If it is then when should we
> > expect to see it?
> >
> > Stephen
> >
>
> This is cute. Could you ask your friend what a multi-threaded
> TCP/IP stack is?
>
> His friend probably refers to the locking used by the stack and how
> much concurrency you'll get with multiple processors.
>
> With 2.2.x most of the stack is under a single lock, with 2.4.x
> locking will be such that multiple processors can be in the stack at
> the same time (the performance should be much greater then under high
> load on big SMP boxes).

The 2.2 stack is under two independent locks (kernel lock and bh lock).
In later 2.2 the expensive parts of the TX path (copy
and checksum) run outside the kernel lock. About half of Incoming runs
in the serialized NETBH, but you can save a lot of that by using
a NIC that that supports hardware checksumming like the Tornado.
The copy from kernel to user in RX runs outside the kernel lock again
in later 2.2 and can work fully in parallel.
Checksumming and copying are the really expensive parts of TCP, you
can say that 50-60% of 2.2 TCP are already fully SMP multithreaded because of
these simple tricks.

2.4 has a more finegrained locking, but it'll of course cost you
in most cases (locks are expensive and generate lots of slow bus traffic)

-Andi

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sat Jul 15 2000 - 21:00:18 EST