Re: [PATCH] reduce the spinlock conflict during massive connect

2017-11-05 Thread Eric Dumazet
On Mon, 2017-11-06 at 14:48 +0800, Liu Yu wrote: > On Mon, Nov 6, 2017 at 1:27 PM, Eric Dumazet wrote: > > On Mon, 2017-11-06 at 10:28 +0800, Liu Yu wrote: > >> From: Liu Yu > >> > >> When a mount of processes connect to the same port at the same

Re: [PATCH] reduce the spinlock conflict during massive connect

2017-11-05 Thread Liu Yu
On Mon, Nov 6, 2017 at 1:27 PM, Eric Dumazet wrote: > On Mon, 2017-11-06 at 10:28 +0800, Liu Yu wrote: >> From: Liu Yu >> >> When a mount of processes connect to the same port at the same address >> simultaneously, they are likely getting the same

Re: [PATCH] reduce the spinlock conflict during massive connect

2017-11-05 Thread Liu Yu
On Mon, Nov 6, 2017 at 12:12 PM, Cong Wang wrote: > On Sun, Nov 5, 2017 at 6:28 PM, Liu Yu wrote: >> - spin_lock_bh(>lock); >> + ret = spin_trylock(>lock); > > Clearly you want spin_trylock_bh() instead. Good catch!

Re: [PATCH] reduce the spinlock conflict during massive connect

2017-11-05 Thread Eric Dumazet
On Mon, 2017-11-06 at 10:28 +0800, Liu Yu wrote: > From: Liu Yu > > When a mount of processes connect to the same port at the same address > simultaneously, they are likely getting the same bhash and therefore > conflict with each other. > > The more the cpu number, the

Re: [PATCH] reduce the spinlock conflict during massive connect

2017-11-05 Thread Cong Wang
On Sun, Nov 5, 2017 at 6:28 PM, Liu Yu wrote: > - spin_lock_bh(>lock); > + ret = spin_trylock(>lock); Clearly you want spin_trylock_bh() instead.

[PATCH] reduce the spinlock conflict during massive connect

2017-11-05 Thread Liu Yu
From: Liu Yu When a mount of processes connect to the same port at the same address simultaneously, they are likely getting the same bhash and therefore conflict with each other. The more the cpu number, the worse in this case. Use spin_trylock instead for this scene,