Skip to content

Commit

Permalink
percpu: zero memory more efficiently in mm/percpu.c::pcpu_mem_alloc()
Browse files Browse the repository at this point in the history
Don't do vmalloc() + memset() when vzalloc() will do.

tj: dropped unnecessary temp variable ptr.

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
Signed-off-by: Tejun Heo <tj@kernel.org>
  • Loading branch information
jjuhl authored and htejun committed Dec 7, 2010
1 parent cf7d7e5 commit 7af4c09
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions mm/percpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -293,12 +293,8 @@ static void *pcpu_mem_alloc(size_t size)

if (size <= PAGE_SIZE)
return kzalloc(size, GFP_KERNEL);
else {
void *ptr = vmalloc(size);
if (ptr)
memset(ptr, 0, size);
return ptr;
}
else
return vzalloc(size);
}

/**
Expand Down

0 comments on commit 7af4c09

Please sign in to comment.