[ofa-general] [PATCH] ib/fmr_pool: allocage page list only when caching enabled
Or Gerlitz
ogerlitz at voltaire.com
Tue Jan 29 02:56:18 PST 2008
Allocate memory for the page_list field of struct ib_pool_fmr only when
caching is enabled, since it is not used otherwise
Signed-off-by: Or Gerlitz <ogerlitz at voltaire.com>
Index: linux-2.6.24-rc8/drivers/infiniband/core/fmr_pool.c
===================================================================
--- linux-2.6.24-rc8.orig/drivers/infiniband/core/fmr_pool.c 2008-01-28 16:45:41.000000000 +0200
+++ linux-2.6.24-rc8/drivers/infiniband/core/fmr_pool.c 2008-01-29 09:17:56.000000000 +0200
@@ -308,10 +308,13 @@ struct ib_fmr_pool *ib_create_fmr_pool(s
.max_maps = pool->max_remaps,
.page_shift = params->page_shift
};
+ int bytes_per_fmr = sizeof *fmr;
+
+ if (pool->cache_bucket)
+ bytes_per_fmr += params->max_pages_per_fmr * sizeof (u64);
for (i = 0; i < params->pool_size; ++i) {
- fmr = kmalloc(sizeof *fmr + params->max_pages_per_fmr * sizeof (u64),
- GFP_KERNEL);
+ fmr = kmalloc(bytes_per_fmr, GFP_KERNEL);
if (!fmr) {
printk(KERN_WARNING PFX "failed to allocate fmr "
"struct for FMR %d\n", i);
More information about the general
mailing list