Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932741AbdLRIyd (ORCPT ); Mon, 18 Dec 2017 03:54:33 -0500 Received: from mx1.redhat.com ([209.132.183.28]:46534 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932683AbdLRIyc (ORCPT ); Mon, 18 Dec 2017 03:54:32 -0500 From: Vitaly Kuznetsov To: Jia-Ju Bai Cc: kys@microsoft.com, haiyangz@microsoft.com, sthemmin@microsoft.com, devel@linuxdriverproject.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] hv: Fix unnecessary sleeping in hv_synic_alloc References: <1513584695-6742-1-git-send-email-baijiaju1990@gmail.com> Date: Mon, 18 Dec 2017 09:54:28 +0100 In-Reply-To: <1513584695-6742-1-git-send-email-baijiaju1990@gmail.com> (Jia-Ju Bai's message of "Mon, 18 Dec 2017 16:11:35 +0800") Message-ID: <87r2rs76wr.fsf@vitty.brq.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Mon, 18 Dec 2017 08:54:32 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1187 Lines: 36 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" -- Vitaly