提交 5c64a8df 编写于 作者: O Omar Sandoval 提交者: Jens Axboe

sbitmap: don't update the allocation hint on clear after resize

If we have a bunch of high-numbered bits allocated and then we resize
the struct sbitmap_queue, when those bits get cleared, we'll update the
hint and then have to re-randomize it repeatedly. Avoid that by checking
that the cleared bit is still a valid hint. No measurable performance
difference in the common case.
Signed-off-by: NOmar Sandoval <osandov@fb.com>
Signed-off-by: NJens Axboe <axboe@fb.com>
上级 05fd095d
...@@ -321,7 +321,7 @@ void sbitmap_queue_clear(struct sbitmap_queue *sbq, unsigned int nr, ...@@ -321,7 +321,7 @@ void sbitmap_queue_clear(struct sbitmap_queue *sbq, unsigned int nr,
{ {
sbitmap_clear_bit(&sbq->sb, nr); sbitmap_clear_bit(&sbq->sb, nr);
sbq_wake_up(sbq); sbq_wake_up(sbq);
if (likely(!sbq->round_robin)) if (likely(!sbq->round_robin && nr < sbq->sb.depth))
*per_cpu_ptr(sbq->alloc_hint, cpu) = nr; *per_cpu_ptr(sbq->alloc_hint, cpu) = nr;
} }
EXPORT_SYMBOL_GPL(sbitmap_queue_clear); EXPORT_SYMBOL_GPL(sbitmap_queue_clear);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册