Re: Concurrency in TCP stack.

Andi Kleen (ak-uu@muc.de)
27 Nov 1999 09:27:57 +0100


thomas.kelly@queens.oxford.ac.uk (Tom Kelly) writes:

> Hi!
>
> I've been hacking my way around the 2.2.13 TCP stack and I'm a bit
> confused about how the concurrency issues with the shared data (tcp_opt)
> in the socket struct are dealt with. For example, what ensures that the
> congestion window decisions are atomic?
>
> Anyone got any pointers for documentation or a quick overview?

The socket lock (sock_readers) ensures this. From user context
the kernel lock guarantees single entry as long as you don't sleep,
when you sleep (e.g. in a user space access) the TCP code is careful
enough to recheck everything. As long as sock_readers is > 0 the
network bh context rcv_* functions will not be executed for new
arriving packets, they are queued in the backlog instead and processed
in the release_sock.

In 2.3 lock_sock also does the synchronization for user context that
the big kernel lock does in 2.2.

Hope this help,
-Andi

-- 
This is like TV. I don't like TV.

- 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/