Commit 223b4d5c authored by Christophe JAILLET's avatar Christophe JAILLET Committed by Jason Gunthorpe

RDMA/cxgb4: Use non-atomic bitmap functions when possible

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/0c1c4505ca32f5ba4126e3e324041da191513ef2.1637789139.git.christophe.jaillet@wanadoo.frSigned-off-by: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
parent 967a578a
...@@ -59,7 +59,7 @@ u32 c4iw_id_alloc(struct c4iw_id_table *alloc) ...@@ -59,7 +59,7 @@ u32 c4iw_id_alloc(struct c4iw_id_table *alloc)
alloc->last = obj + 1; alloc->last = obj + 1;
if (alloc->last >= alloc->max) if (alloc->last >= alloc->max)
alloc->last = 0; alloc->last = 0;
set_bit(obj, alloc->table); __set_bit(obj, alloc->table);
obj += alloc->start; obj += alloc->start;
} else } else
obj = -1; obj = -1;
...@@ -75,7 +75,7 @@ void c4iw_id_free(struct c4iw_id_table *alloc, u32 obj) ...@@ -75,7 +75,7 @@ void c4iw_id_free(struct c4iw_id_table *alloc, u32 obj)
obj -= alloc->start; obj -= alloc->start;
spin_lock_irqsave(&alloc->lock, flags); spin_lock_irqsave(&alloc->lock, flags);
clear_bit(obj, alloc->table); __clear_bit(obj, alloc->table);
spin_unlock_irqrestore(&alloc->lock, flags); spin_unlock_irqrestore(&alloc->lock, flags);
} }
......
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