Re: [PATCH] net/core/sock.c remove extra wakeup
From: Andi Kleen <hidden>
Date: 2008-06-01 21:05:38
From: Andi Kleen <hidden>
Date: 2008-06-01 21:05:38
"Patrick Mullaney" [off-list ref] writes:
Would a better approach be? 1) clear the bit when the waiter returns(bottom of sock_wait_for_wmem) 2) add a new wait-queue to the socket to separate the writers 3) another idea?
A large reason this is tricky is because it is essentially lockless. So alternative would be: 4) you add a spinlock which is always taken around the various condition checks and bit manipulation. Not 100% sure if it would be bad to general SMP scalability (you would need to ensure that the bouncing lock cache line isn't a performance problem), but at least it would be much safer and makes it much easier to verify your change is correct. Actually the wait queue already has such a lock, so it might not be that expensive if you switch the wait queue to a lockless version. -Andi