diff options
author | Roland Dreier <rolandd@cisco.com> | 2008-07-22 14:19:40 -0700 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2008-07-22 14:19:40 -0700 |
commit | e4044cfc493338cd09870bd45dc646336bb66e9f (patch) | |
tree | 2385c18ee6a79393b4e1c5c25ee1f0f980d7da93 /drivers/net/mlx4/mlx4.h | |
parent | 899698dad72340b562478b8b770317f2f0fe0c09 (diff) | |
download | op-kernel-dev-e4044cfc493338cd09870bd45dc646336bb66e9f.zip op-kernel-dev-e4044cfc493338cd09870bd45dc646336bb66e9f.tar.gz |
mlx4_core: 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/net/mlx4/mlx4.h')
-rw-r--r-- | drivers/net/mlx4/mlx4.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/net/mlx4/mlx4.h b/drivers/net/mlx4/mlx4.h index a4023c2..7803849 100644 --- a/drivers/net/mlx4/mlx4.h +++ b/drivers/net/mlx4/mlx4.h @@ -118,6 +118,7 @@ struct mlx4_bitmap { struct mlx4_buddy { unsigned long **bits; + unsigned int *num_free; int max_order; spinlock_t lock; }; |