From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752586AbdI0IWi (ORCPT ); Wed, 27 Sep 2017 04:22:38 -0400 Received: from mx2.suse.de ([195.135.220.15]:37530 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752007AbdI0IVA (ORCPT ); Wed, 27 Sep 2017 04:21:00 -0400 From: Johannes Thumshirn To: Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Damien Le Moal , Christoph Hellwig , Johannes Thumshirn Subject: [PATCH 2/6] block: use kmalloc_array_node Date: Wed, 27 Sep 2017 10:20:34 +0200 Message-Id: <20170927082038.3782-3-jthumshirn@suse.de> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20170927082038.3782-1-jthumshirn@suse.de> References: <20170927082038.3782-1-jthumshirn@suse.de> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Signed-off-by: Johannes Thumshirn --- block/blk-mq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/blk-mq.c b/block/blk-mq.c index 98a18609755e..49f9dc0eb47c 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -1979,7 +1979,7 @@ static int blk_mq_init_hctx(struct request_queue *q, * 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; -- 2.13.5 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f198.google.com (mail-wr0-f198.google.com [209.85.128.198]) by kanga.kvack.org (Postfix) with ESMTP id EBB646B025F for ; Wed, 27 Sep 2017 04:21:00 -0400 (EDT) Received: by mail-wr0-f198.google.com with SMTP id b9so14760140wra.3 for ; Wed, 27 Sep 2017 01:21:00 -0700 (PDT) Received: from mx1.suse.de (mx2.suse.de. [195.135.220.15]) by mx.google.com with ESMTPS id r1si8859615wre.56.2017.09.27.01.20.59 for (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 27 Sep 2017 01:20:59 -0700 (PDT) From: Johannes Thumshirn Subject: [PATCH 2/6] block: use kmalloc_array_node Date: Wed, 27 Sep 2017 10:20:34 +0200 Message-Id: <20170927082038.3782-3-jthumshirn@suse.de> In-Reply-To: <20170927082038.3782-1-jthumshirn@suse.de> References: <20170927082038.3782-1-jthumshirn@suse.de> Sender: owner-linux-mm@kvack.org List-ID: To: Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Damien Le Moal , Christoph Hellwig , Johannes Thumshirn 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. Signed-off-by: Johannes Thumshirn --- block/blk-mq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/blk-mq.c b/block/blk-mq.c index 98a18609755e..49f9dc0eb47c 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -1979,7 +1979,7 @@ static int blk_mq_init_hctx(struct request_queue *q, * 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; -- 2.13.5 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org