lkml.org 
[lkml]   [2013]   [Oct]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] rtc: pl030: Use devm_kzalloc() instead of kmalloc()
Hello,

On Thu, Oct 10, 2013 at 04:06:03PM -0700, Andrew Morton wrote:
> On Tue, 08 Oct 2013 21:59:27 -0700 Joe Perches <joe@perches.com> wrote:
>
> > I was a bit surprised to find there isn't a devm_kmalloc.
>
> Yes, the unconditional memset is silly. Especially when the
> function has a handy gfp_t and could be passed __GFP_ZERO.
>
> The comment says "managed kzalloc/kfree for device drivers, no kmalloc,
> always use kzalloc". There's no explanation for this - it looks like
> some ideological thing.

Skipping resetting just is highly unlikely to make any meaningful
difference in the paths devres is supposed to be used. These don't
and shouldn't get called from hot paths. Wouldn't it be more
idelogical to have something just because it feels weird not to have
it even if it is not necessary? I don't necessarily object to having
non-zeroing interface but it seems rather pointless. Do we have an
actual cases where this makes meaningful differences?

> - memset(dr, 0, tot_size);
> + if (gfp & __GFP_ZERO)
> + memset(dr, 0, tot_size);

I'd much prefer to have at least the devres_node part cleared
regardless of __GFP_ZERO and Joe already has better patches doing
this.

Thanks.

--
tejun


\
 
 \ /
  Last update: 2013-10-11 01:41    [W:0.051 / U:0.184 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site