lkml.org 
[lkml]   [2017]   [Dec]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH V2] hyper-v: use GFP_KERNEL for hv_context.hv_numa_map
On Mon, 18 Dec 2017 17:02:52 +0800
Jia-Ju Bai <baijiaju1990@gmail.com> 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 <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;

Thanks, for fixing this.
While you are at it; wouldn't it make sense to use kcalloc here?

\
 
 \ /
  Last update: 2017-12-18 18:06    [W:0.042 / U:0.052 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site