linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3] Fix one error in mthca_alloc
@ 2021-08-27  0:52 kangning
  2021-08-31  9:52 ` Leon Romanovsky
  0 siblings, 1 reply; 7+ messages in thread
From: kangning @ 2021-08-27  0:52 UTC (permalink / raw)
  To: haakon.bugge; +Cc: linux-rdma, kangning

drivers/infiniband/hw/mthca/mthca_allocator.c: alloc->last left unchanged in mthca_alloc, which
has impact on performance of function find_next_zero_bit in mthca_alloc.

Signed-off-by: kangning <kangning18z@ict.ac.cn>
---
 
 I squashed two commits into one in this version.
 
 drivers/infiniband/hw/mthca/mthca_allocator.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/infiniband/hw/mthca/mthca_allocator.c b/drivers/infiniband/hw/mthca/mthca_allocator.c
index aef1d274a14e..1141695093e7 100644
--- a/drivers/infiniband/hw/mthca/mthca_allocator.c
+++ b/drivers/infiniband/hw/mthca/mthca_allocator.c
@@ -51,6 +51,9 @@ u32 mthca_alloc(struct mthca_alloc *alloc)
 	}
 
 	if (obj < alloc->max) {
+		alloc->last = obj + 1;
+		if (alloc->last == alloc->max)
+			alloc->last = 0;
 		set_bit(obj, alloc->table);
 		obj |= alloc->top;
 	} else
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-09-01  7:51 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-27  0:52 [PATCH v3] Fix one error in mthca_alloc kangning
2021-08-31  9:52 ` Leon Romanovsky
2021-08-31 10:40   ` 康宁
2021-08-31 12:00     ` Leon Romanovsky
2021-08-31 12:16       ` kangning18z
2021-08-31 10:47   ` 康宁
     [not found]   ` <202109011027459851120@ict.ac.cn>
2021-09-01  7:51     ` Leon Romanovsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).