Skip to contentSkip to conversation

block/blk-mq.c: use kmalloc_array_node()

PATCH New [email protected] 1 participant 1 message Nov 16, 2017 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 22/131 block/blk-mq.c: use kmalloc_array_node()

From: Johannes Thumshirn <[email protected]>
Subject: block/blk-mq.c: use kmalloc_array_node()

Now that we have a NUMA-aware version of kmalloc_array() we can use it instead of kmalloc_node() without an overflow check in the size calculation.

Cc Pekka Enberg <[email protected]>
Cc David Rientjes <[email protected]>
Cc Joonsoo Kim <[email protected]>
Cc Damien Le Moal <[email protected]>
Cc Christoph Hellwig <[email protected]>
Cc Jens Axboe <[email protected]>
Cc "David S. Miller" <[email protected]>
Cc Doug Ledford <[email protected]>
Cc Hal Rosenstock <[email protected]>
Cc Mike Marciniszyn <[email protected]>
Cc Santosh Shilimkar <[email protected]>
Cc Sean Hefty <[email protected]>
Cc Vlastimil Babka <[email protected]>

---

 block/blk-mq.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
block/blk-mq.c renamed from block/blk-mq.c~block-use-kmalloc_array_node +1 -1
diff -puN block/blk-mq.c~block-use-kmalloc_array_node block/blk-mq.c
@@ -2047,7 +2047,7 @@ static int blk_mq_init_hctx(struct reque
 	 * Allocate space for all possible cpus to avoid allocation at
 	 * runtime
 	 */
-	hctx->ctxs = kmalloc_node(nr_cpu_ids * sizeof(void *),
+	hctx->ctxs = kmalloc_array_node(nr_cpu_ids, sizeof(void *),
 					GFP_KERNEL, node);
 	if (!hctx->ctxs)
 		goto unregister_cpu_notifier;

_