Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932757AbdLRI6h (ORCPT ); Mon, 18 Dec 2017 03:58:37 -0500 Received: from mail-io0-f195.google.com ([209.85.223.195]:46503 "EHLO mail-io0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932558AbdLRI6g (ORCPT ); Mon, 18 Dec 2017 03:58:36 -0500 X-Google-Smtp-Source: ACJfBotu8XiqEAN8di0KKRyyosqRKkFa8h/DGAKVtqggaGjJ3kIECPCRPu1+Wsufi6w7A+E9feDF4w== Subject: Re: [PATCH] hv: Fix unnecessary sleeping in hv_synic_alloc To: Vitaly Kuznetsov Cc: kys@microsoft.com, haiyangz@microsoft.com, sthemmin@microsoft.com, devel@linuxdriverproject.org, linux-kernel@vger.kernel.org References: <1513584695-6742-1-git-send-email-baijiaju1990@gmail.com> <87r2rs76wr.fsf@vitty.brq.redhat.com> From: Jia-Ju Bai Message-ID: <55fd96a5-84f1-0b0a-c8b7-601a96f387e6@gmail.com> Date: Mon, 18 Dec 2017 16:58:20 +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: <87r2rs76wr.fsf@vitty.brq.redhat.com> 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: 1415 Lines: 44 On 2017/12/18 16:54, Vitaly Kuznetsov wrote: > Jia-Ju Bai writes: > >> 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; > Reviewed-by: Vitaly Kuznetsov > > The subject line is not very accurate: GFP_KERNEL you switch too is the > one supporting 'sleep' when there's not enough memory, not > GFP_ATOMIC so you don't actually "Fix unnecessary sleeping". I'd suggest > you use something like "hyper-v: use GFP_KERNEL for hv_context.hv_numa_map" > Thanks for you suggestion :) Okay, I found my description is not correct, too, sorry. I will revise it and resubmit the patch. Thanks, Jia-Ju Bai