On Sun, 2019-01-13 at 22:46 +0800, Gavin Hu wrote: > ------------------------------------------------------------------- > --- > From: Joyce Kong <[email protected]> > > The spinlock implementation is unfair, some threads may take locks > aggressively while leaving the other threads starving for long time. > As > shown in the following test, within same period of time, there are > threads taking locks much more times than the others. > > The ticketlock gives each waiting thread a ticket and they can take > the > lock one by one, first come, first serviced, this avoids starvation > for > too long time and is more predictable. > > *** spinlock_autotest without this patch *** > Core [0] count = 89 > Core [1] count = 84 > Core [2] count = 94 > ... > Core [208] count = 171 > Core [209] count = 152 > Core [210] count = 161 > Core [211] count = 187 > > *** spinlock_autotest with this patch ***
This comment needs to be updated as it is new API now and we need add test case for the same. I think, making modification to exiting spinlock test case would be fine. > Core [0] count = 534 > Core [1] count = 533 > Core [2] count = 542 > ... > Core [208] count = 554 > Core [209] count = 556 > Core [210] count = 555 > Core [211] count = 551 > > Signed-off-by: Joyce Kong <[email protected]> > Signed-off-by: Gavin Hu <[email protected]> > --- >

