Thread (29 messages) 29 messages, 5 authors, 2021-05-19

Re: [PATCH v3] mm, slub: change run-time assertion in kmalloc_index() to compile-time

From: Hyeonggon Yoo <hidden>
Date: 2021-05-13 12:11:53
Also in: lkml

On Thu, May 13, 2021 at 01:37:38PM +0200, Vlastimil Babka wrote:
quoted
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
quoted
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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help