Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1761538AbdLSIlR (ORCPT ); Tue, 19 Dec 2017 03:41:17 -0500 Received: from mail-io0-f193.google.com ([209.85.223.193]:43781 "EHLO mail-io0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759138AbdLSIlF (ORCPT ); Tue, 19 Dec 2017 03:41:05 -0500 X-Google-Smtp-Source: ACJfBov8dUDCjLSdR84QcrHD+DkICL3Im3Y/pAO8Ftr3sy5JqcXtUHot7miynlKvmNyf7vs6wein7w== Subject: Re: [PATCH V2] hyper-v: use GFP_KERNEL for hv_context.hv_numa_map To: Stephen Hemminger Cc: kys@microsoft.com, haiyangz@microsoft.com, sthemmin@microsoft.com, devel@linuxdriverproject.org, linux-kernel@vger.kernel.org References: <1513587772-8039-1-git-send-email-baijiaju1990@gmail.com> <20171218090529.5782a91d@xeon-e3> From: Jia-Ju Bai Message-ID: <40ddf089-df5f-e6ae-6ec6-58849e6c9ceb@gmail.com> Date: Tue, 19 Dec 2017 16:40:35 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.2.0 MIME-Version: 1.0 In-Reply-To: <20171218090529.5782a91d@xeon-e3> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1108 Lines: 37 On 2017/12/19 1:05, Stephen Hemminger wrote: > On Mon, 18 Dec 2017 17:02:52 +0800 > Jia-Ju Bai wrote: > >> The kzalloc function is called with GFP_ATOMIC. >> But according to driver call graph, it is not in atomic context, >> namely no spinlock is held nor in an interrupt handler. >> >> This GFP_ATOMIC is unnecessary, and replace with GFP_KERNEL. >> >> Signed-off-by: Jia-Ju Bai >> --- >> drivers/hv/hv.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/drivers/hv/hv.c b/drivers/hv/hv.c >> index 8267439..b0d025a 100644 >> --- a/drivers/hv/hv.c >> +++ b/drivers/hv/hv.c >> @@ -150,7 +150,7 @@ int hv_synic_alloc(void) >> int cpu; >> >> hv_context.hv_numa_map = kzalloc(sizeof(struct cpumask) * nr_node_ids, >> - GFP_ATOMIC); >> + GFP_KERNEL); >> if (hv_context.hv_numa_map == NULL) { >> pr_err("Unable to allocate NUMA map\n"); >> goto err; > Thanks, for fixing this. > While you are at it; wouldn't it make sense to use kcalloc here? I think kcalloc can be used here. Thanks, Jia-Ju Bai