On Mon, 28 Oct 2002, Cheng Jin wrote:
> > The IP network stack in linux is totaly reentrant. You could have a
> > packet on _each_ processor in SMP concurently executing the same code. If
> > you add anything, you need to take this into account.
> We did add code to the TCP layer, but I don't exactly see anything in the
> original code where locking is used. I assume the locks are in the IP
> layer and lower?
There are a few, but they are irrelevant in your case since you dont
touch that code (eg the dst cache lock).
As far as TCP is concerned, serialization between SMP processors happens
with the socket lock. This lock is also used to sequence packets
[Remember TCP has to ensure that packets are sequenced for processing
by user process. Also remember that TCP runs in both user and process
> The weirdest thing is that we noticed in
> update_send_head, tp->packets_out sometimes increases by more than one
> even though the code ++ it only once. I guess I am not sure how we could
> have screwed it up if the modifications are on the TCP layer.
Anything that you want to serialize access to you should put in the sock
struct; then use the sock lock to serialize.