From b7fed6e6d8a2a9d27abe083312e0cc96b5f73af0 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Thu, 5 Feb 2015 12:43:37 -0800 Subject: [PATCH] Use vmem_alloc() for nvlists Several of the nvlist functions may perform allocations larger than the 32k warning threshold. Convert them to use vmem_alloc() so the best allocation is used. Commit efcd79a retired KM_NODEBUG which was used to suppress large allocation warnings. Concurrently in the SPL the warning threshold was increased from 8k to 32k. The goal was to identify the remaining locations, such as this one, where the allocation can be larger than 32k. This was expected fine tuning for the kmem-rework changes, see commit 6e9710f. Signed-off-by: Brian Behlendorf Issue #3057 --- module/nvpair/nvpair_alloc_spl.c | 5 +++-- module/zfs/spa.c | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/module/nvpair/nvpair_alloc_spl.c b/module/nvpair/nvpair_alloc_spl.c index f9055b94f100..bc377ab66257 100644 --- a/module/nvpair/nvpair_alloc_spl.c +++ b/module/nvpair/nvpair_alloc_spl.c @@ -26,17 +26,18 @@ #include #include +#include static void * nv_alloc_sleep_spl(nv_alloc_t *nva, size_t size) { - return (kmem_alloc(size, KM_SLEEP)); + return (vmem_alloc(size, KM_SLEEP)); } static void * nv_alloc_pushpage_spl(nv_alloc_t *nva, size_t size) { - return (kmem_alloc(size, KM_PUSHPAGE)); + return (vmem_alloc(size, KM_PUSHPAGE)); } static void * diff --git a/module/zfs/spa.c b/module/zfs/spa.c index 55bcf43f884c..861a319afdb7 100644 --- a/module/zfs/spa.c +++ b/module/zfs/spa.c @@ -1586,12 +1586,12 @@ load_nvlist(spa_t *spa, uint64_t obj, nvlist_t **value) nvsize = *(uint64_t *)db->db_data; dmu_buf_rele(db, FTAG); - packed = kmem_alloc(nvsize, KM_SLEEP); + packed = vmem_alloc(nvsize, KM_SLEEP); error = dmu_read(spa->spa_meta_objset, obj, 0, nvsize, packed, DMU_READ_PREFETCH); if (error == 0) error = nvlist_unpack(packed, nvsize, value, 0); - kmem_free(packed, nvsize); + vmem_free(packed, nvsize); return (error); }