aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw/mthca/mthca_dev.h
diff options
context:
space:
mode:
authorRoland Dreier <rolandd@cisco.com>2008-07-22 14:20:05 -0700
committerRoland Dreier <rolandd@cisco.com>2008-07-22 14:20:05 -0700
commite8bb4beb2b1f90d499134f2849727ed04c3bedc4 (patch)
tree3c4be492134aa4a738d1eeef144642d3e2bc9509 /drivers/infiniband/hw/mthca/mthca_dev.h
parentmarkers: fix duplicate modpost entry (diff)
downloadlinux-dev-e8bb4beb2b1f90d499134f2849727ed04c3bedc4.tar.xz
linux-dev-e8bb4beb2b1f90d499134f2849727ed04c3bedc4.zip
IB/mthca: Keep free count for MTT buddy allocator
MTT entries are allocated with a buddy allocator, which just keeps bitmaps for each level of the buddy table. However, all free space starts out at the highest order, and small allocations start scanning from the lowest order. When the lowest order tables have no free space, this can lead to scanning potentially millions of bits before finding a free entry at a higher order. We can avoid this by just keeping a count of how many free entries each order has, and skipping the bitmap scan when an order is completely empty. This provides a nice performance boost for a negligible increase in memory usage. Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband/hw/mthca/mthca_dev.h')
-rw-r--r--drivers/infiniband/hw/mthca/mthca_dev.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/infiniband/hw/mthca/mthca_dev.h b/drivers/infiniband/hw/mthca/mthca_dev.h
index ee4d073c889f..252590116df5 100644
--- a/drivers/infiniband/hw/mthca/mthca_dev.h
+++ b/drivers/infiniband/hw/mthca/mthca_dev.h
@@ -202,6 +202,7 @@ struct mthca_pd_table {
struct mthca_buddy {
unsigned long **bits;
+ int *num_free;
int max_order;
spinlock_t lock;
};