All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vitaly Kuznetsov <vkuznets@redhat.com>
To: Jia-Ju Bai <baijiaju1990@gmail.com>
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
Date: Mon, 18 Dec 2017 09:54:28 +0100	[thread overview]
Message-ID: <87r2rs76wr.fsf@vitty.brq.redhat.com> (raw)
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")

Jia-Ju Bai <baijiaju1990@gmail.com> 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 <baijiaju1990@gmail.com>
> ---
>  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 <vkuznets@redhat.com>

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

  reply	other threads:[~2017-12-18  8:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-18  8:11 [PATCH] hv: Fix unnecessary sleeping in hv_synic_alloc Jia-Ju Bai
2017-12-18  8:54 ` Vitaly Kuznetsov [this message]
2017-12-18  8:58   ` Jia-Ju Bai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87r2rs76wr.fsf@vitty.brq.redhat.com \
    --to=vkuznets@redhat.com \
    --cc=baijiaju1990@gmail.com \
    --cc=devel@linuxdriverproject.org \
    --cc=haiyangz@microsoft.com \
    --cc=kys@microsoft.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sthemmin@microsoft.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.