Commit 19453f34 authored by Christophe JAILLET's avatar Christophe JAILLET Committed by Jason Gunthorpe

IB/mthca: Use non-atomic bitmap functions when possible in 'mthca_allocator.c'

The accesses to the 'alloc->table' bitmap are protected by the
'alloc->lock' spinlock, so no concurrent accesses can happen.

So prefer the non-atomic '__[set|clear]_bit()' functions to save a few
cycles.

Link: https://lore.kernel.org/r/5f909ca1284fa4d2cf13952b08b9e303b656c968.1637785902.git.christophe.jaillet@wanadoo.frSigned-off-by: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
parent a277f383
...@@ -51,7 +51,7 @@ u32 mthca_alloc(struct mthca_alloc *alloc) ...@@ -51,7 +51,7 @@ u32 mthca_alloc(struct mthca_alloc *alloc)
} }
if (obj < alloc->max) { if (obj < alloc->max) {
set_bit(obj, alloc->table); __set_bit(obj, alloc->table);
obj |= alloc->top; obj |= alloc->top;
} else } else
obj = -1; obj = -1;
...@@ -69,7 +69,7 @@ void mthca_free(struct mthca_alloc *alloc, u32 obj) ...@@ -69,7 +69,7 @@ void mthca_free(struct mthca_alloc *alloc, u32 obj)
spin_lock_irqsave(&alloc->lock, flags); spin_lock_irqsave(&alloc->lock, flags);
clear_bit(obj, alloc->table); __clear_bit(obj, alloc->table);
alloc->last = min(alloc->last, obj); alloc->last = min(alloc->last, obj);
alloc->top = (alloc->top + alloc->max) & alloc->mask; alloc->top = (alloc->top + alloc->max) & alloc->mask;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment