lkml.org 
[lkml]   [2021]   [May]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3] mm, slub: change run-time assertion in kmalloc_index() to compile-time
On Thu, May 13, 2021 at 01:37:38PM +0200, Vlastimil Babka wrote:
> > See my suggestion below that builds on Andrew's size_is_constant but
> > would retain the old interface and support testing.
>
> I can accept that, but please also modify/expand the newly added comment. Now
> it's *normally* evaluated in compile-time. And there should be warning that
> anyone calling it with size_is_constant == false should do that only in context
> where performance (and code bloat, most likely too) doesn't matter, such as unit
> test.
>
> Thanks, Vlastimil
>
> > Thanks,

I completely agree on what Vlastimil said. there should be comment
saying that generally you should not use kmalloc_index with
size_is_const == true.

and the caller MUST guarantee that size_is_const is correct.
if not, it would be so confusing.

\
 
 \ /
  Last update: 2021-05-13 14:12    [W:0.077 / U:0.576 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site