lkml.org 
[lkml]   [2022]   [Oct]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3][next] skbuff: Proactively round up to kmalloc bucket size
On Thu, Oct 20, 2022 at 10:42:47AM +0200, Paolo Abeni wrote:
> > size = SKB_DATA_ALIGN(size);
> > size += SKB_DATA_ALIGN(sizeof(struct skb_shared_info));
> > - data = kmalloc_reserve(size, gfp_mask, node, &pfmemalloc);
> > - if (unlikely(!data))
> > - goto nodata;
>
> I'm sorry for not noticing the above in the previous iteration, but I
> think this revision will produce worse code than the V1, as
> kmalloc_reserve() now pollutes an additional register.
>
> Why did you prefer adding an additional parameter to kmalloc_reserve()?
> I think computing the alloc_size in the caller is even more readable.
>
> Additionally, as a matter of personal preference, I would not introduce
> an additional variable for alloc_size, just:
>
> // ...
> size = kmalloc_size_roundup(size);
> data = kmalloc_reserve(size, gfp_mask, node, &pfmemalloc);
>
> The rationale is smaller diff, and consistent style with the existing
> code where 'size' is already adjusted multiple times icrementally.

Sure, I can do that. I will respin it. :)

--
Kees Cook

\
 
 \ /
  Last update: 2022-10-21 18:13    [W:0.111 / U:0.328 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site