percpu_ida: fix a live lock
authorShaohua Li <shli@fusionio.com>
Fri, 24 Jan 2014 21:13:53 +0000 (13:13 -0800)
committerJens Axboe <axboe@fb.com>
Mon, 30 Mar 2015 18:54:40 +0000 (12:54 -0600)
commitd9b8a3e422cd992057829d6f42c375f08b964606
tree1373d1a9e89ceea20e2efe98f9d1df3749adba87
parent36104d22f73fba6a658c7d51174704d2a752bb15
percpu_ida: fix a live lock

steal_tags only happens when free tags is more than half of the total
tags.  This is too strict and can cause live lock. I found that if one
cpu has free tags, but other cpu can't steal (thread is bound to
specific cpus), threads which want to allocate tags are always
sleeping. I found this when I run next patch, but this could happen
without it I think.

I did performance test too with null_blk. Two cases (each cpu has enough
percpu tags, or total tags are limited), no performance changes were
observed.

Signed-off-by: Shaohua Li <shli@fusionio.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
lib/percpu_ida.c