From 33d9640be47667b96d31498ccb6824904925d8ee Mon Sep 17 00:00:00 2001 From: Russell Cattelan Date: Thu, 15 Jun 2017 14:57:02 -0500 Subject: [PATCH] LU-10185 gnilnd: Use consistent size for GNI MBOX. KMALLOC_MAX_SIZE is not consistent when changing the allocator. For example when using the SLUB allocator the size is set to 30 bits. For slab allocator the max size is 25 bits or 32MB. For SLAB this is a no-op change for other allocators the size is also set to 32MB. Test-parameters: trivial Signed-off-by: Chris Horn Change-Id: Icab4c69f9afd276d55360a76991ba9783f83ac8b Reviewed-on: https://review.whamcloud.com/29895 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: James Simmons Reviewed-by: Doug Oucharek Reviewed-by: Oleg Drokin --- lnet/klnds/gnilnd/gnilnd.c | 2 +- lnet/klnds/gnilnd/gnilnd.h | 9 +++++++++ lnet/klnds/gnilnd/gnilnd_conn.c | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/lnet/klnds/gnilnd/gnilnd.c b/lnet/klnds/gnilnd/gnilnd.c index 4976a07..4b79eeb 100644 --- a/lnet/klnds/gnilnd/gnilnd.c +++ b/lnet/klnds/gnilnd/gnilnd.c @@ -2336,7 +2336,7 @@ int kgnilnd_base_startup(void) } kgnilnd_data.kgn_mbox_cache = - kmem_cache_create("kgn_mbox_block", KMALLOC_MAX_SIZE, 0, + kmem_cache_create("kgn_mbox_block", GNILND_MBOX_SIZE, 0, SLAB_HWCACHE_ALIGN, NULL); if (kgnilnd_data.kgn_mbox_cache == NULL) { CERROR("Can't create slab for physical mbox blocks\n"); diff --git a/lnet/klnds/gnilnd/gnilnd.h b/lnet/klnds/gnilnd/gnilnd.h index b0d0f89..9ab8056 100644 --- a/lnet/klnds/gnilnd/gnilnd.h +++ b/lnet/klnds/gnilnd/gnilnd.h @@ -68,6 +68,15 @@ #include #include "gnilnd_version.h" +#ifdef CONFIG_SLAB +#define GNILND_MBOX_SIZE KMALLOC_MAX_SIZE +#else +#define GNILND_SHIFT_HIGH ((MAX_ORDER + PAGE_SHIFT - 1) <= 25 ? \ + (MAX_ORDER + PAGE_SHIFT - 1) : 25) +#define GNILND_SHIFT_MAX GNILND_SHIFT_HIGH +#define GNILND_MBOX_SIZE (1UL << GNILND_SHIFT_MAX) +#endif + /* tunables determined at compile time */ #define GNILND_MIN_TIMEOUT 5 /* minimum timeout interval (seconds) */ diff --git a/lnet/klnds/gnilnd/gnilnd_conn.c b/lnet/klnds/gnilnd/gnilnd_conn.c index a281130..aa48010 100644 --- a/lnet/klnds/gnilnd/gnilnd_conn.c +++ b/lnet/klnds/gnilnd/gnilnd_conn.c @@ -161,7 +161,7 @@ kgnilnd_alloc_fmablk(kgn_device_t *device, int use_phys) rc = -ENOMEM; GOTO(free_desc, rc); } - fma_blk->gnm_blk_size = KMALLOC_MAX_SIZE; + fma_blk->gnm_blk_size = GNILND_MBOX_SIZE; num_mbox = fma_blk->gnm_blk_size / fma_blk->gnm_mbox_size; LASSERTF(num_mbox >= 1, -- 1.8.3.1