1) serialization is against n-CPUs towards the socket.
2) ordered data (dont care whether its 1 or n-CPUs). TCP cares, UDP
The main TCP path towards the socket runs in softirq context - you can
have the same softirq code running on multiple CPUs at the same time. The
system call is in process context.
On Wed, 4 Dec 2002, Ronghua Zhang wrote:
> Do you mean that net_bh can be running on several CPU at the same time?
> If it is juat a UP, can I say that socket system call and net_bh is always
> serialized even without lock_sock()?
> On Wed, 4 Dec 2002, jamal wrote:
> > 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