Messages in this thread | | | Date | Thu, 22 Aug 2013 10:56:08 -0600 | From | Jens Axboe <> | Subject | Re: [PATCH] idr: Use this_cpu_ptr() for percpu_ida |
| |
On 08/22/2013 10:44 AM, Christoph Lameter wrote: > On Wed, 21 Aug 2013, Andrew Morton wrote: > >> The lock is needed so that one cpu can steal tags from another cpu's cache. >> See (the needlessly inlined!) steal_tags(). > > Stealing tags could also be done via IPIs or some other things.
That is actually the approach I took for blk-mq tagging. But that isn't free either. I think it pretty much boils down to how much stealing you expect. If the tag space is sufficiently large, you would not expect a lot of stealing. And then it doesn't really matter if you use a lock or an IPI, since it's the rare case - the lock cacheline isn't going to be shared across processors anyway. The ticket locks aren't exactly free on their own, however, so that cost is still paid. But I'd be surprised if it was much of an issue.
If the tag space isn't large enough (common case), then yes, it matters a lot what kind of mechanism is used. It's on my TODO to compare the two under realistic scenarios and see how they fare.
-- Jens Axboe
| |