netdev
[Top] [All Lists]

Re: synchronization between bottom half and user context

To: Ronghua Zhang <rz5b@xxxxxxxxxxxxxxx>
Subject: Re: synchronization between bottom half and user context
From: jamal <hadi@xxxxxxxxxx>
Date: Wed, 4 Dec 2002 07:51:34 -0500 (EST)
Cc: <netdev@xxxxxxxxxxx>
In-reply-to: <Pine.LNX.4.44.0212030038030.1334-100000@bobbidi.cs.virginia.edu>
Sender: netdev-bounce@xxxxxxxxxxx

On Tue, 3 Dec 2002, Ronghua Zhang wrote:

> Can someone tell me when lock should be used to synchronize bh and user
> context?
>
> For examle: in tcp_accept(), lock_sock() is called to avoid any change
> made by net_bh during its operation. But if tcp_accept() is called, it's
> impossilbe that net_bh is also executing. (i think this is true for UP,
> what about SMP?), then why need lock_sock()?
>

to serialize packets towards the socket; The linux network stack
is threaded, you can have upto n packets to the same socket coming up the
stack in parallel on an n-SMP machine; think of that and the fact that TCP
data must be sequenced.

cheers,
jamal


<Prev in Thread] Current Thread [Next in Thread>