Thread (2 messages) 2 messages, 2 authors, 2021-08-26

Re: [PATCH] Fix one error in mthca_alloc

From: Haakon Bugge <hidden>
Date: 2021-08-26 12:49:49

quoted hunk ↗ jump to hunk
On 26 Aug 2021, at 12:52, kangning [off-list ref] wrote:

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 <redacted>
---
drivers/infiniband/hw/mthca/mthca_allocator.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/infiniband/hw/mthca/mthca_allocator.c b/drivers/infiniband/hw/mthca/mthca_allocator.c
index aef1d274a14e..e81bb0fcd08e 100644
--- a/drivers/infiniband/hw/mthca/mthca_allocator.c
+++ b/drivers/infiniband/hw/mthca/mthca_allocator.c
@@ -51,6 +51,10 @@ u32 mthca_alloc(struct mthca_alloc *alloc)
	}

	if (obj < alloc->max) {
+		alloc->last = (obj + 1);
No need for parenthesis.
+		if (alloc->last == alloc->max) {
No need for braces.


Otherwise, looks good to me:

Reviewed-by: Håkon Bugge <redacted>

+			alloc->last = 0;
+		}
		set_bit(obj, alloc->table);
		obj |= alloc->top;
	} else
-- 
2.17.1
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help