<div dir="ltr"><div>This is great! One patch less (if accepted).<br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Apr 17, 2013 at 4:25 PM, Behan Webster <span dir="ltr">&lt;<a href="mailto:behanw@converseincode.com" target="_blank">behanw@converseincode.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div>Steve has submitted a patch to remove the __builtin_constant_p issue. :)</div><div><br></div><div>
Behan<br><br>Sent from my Mobile Computer which is also a phone</div>
<div><br>Begin forwarded message:<br><br></div><blockquote type="cite"><div><b>From:</b> Steven Rostedt &lt;<a href="mailto:rostedt@goodmis.org" target="_blank">rostedt@goodmis.org</a>&gt;<br><b>Date:</b> 17 April, 2013 12:09:36 PM PDT<br>

<b>To:</b> LKML &lt;<a href="mailto:linux-kernel@vger.kernel.org" target="_blank">linux-kernel@vger.kernel.org</a>&gt;, <a href="mailto:linux-mm@kvack.org" target="_blank">linux-mm@kvack.org</a><br><b>Cc:</b> Christoph Lameter &lt;<a href="mailto:cl@linux.com" target="_blank">cl@linux.com</a>&gt;, Behan Webster &lt;<a href="mailto:behanw@converseincode.com" target="_blank">behanw@converseincode.com</a>&gt;,  Andrew Morton &lt;<a href="mailto:akpm@linux-foundation.org" target="_blank">akpm@linux-foundation.org</a>&gt;<br>

<b>Subject:</b> <b>[PATCH] slab: Remove unnecessary __builtin_constant_p()</b><br><br></div></blockquote><blockquote type="cite"><div><span>The slab.c code has a size check macro that checks the size of the</span><br><span>following structs:</span><br>

<span></span><br><span>struct arraycache_init</span><br><span>struct kmem_list3</span><br><span></span><br><span>The index_of() function that takes the sizeof() of the above two structs</span><br><span>and does an unnecessary __builtin_constant_p() on that. As sizeof() will</span><br>

<span>always end up being a constant making this always be true. The code is</span><br><span>not incorrect, but it just adds added complexity, and confuses users and</span><br><span>wastes the time of reviewers of the code, who spends time trying to</span><br>

<span>figure out why the builtin_constant_p() was used.</span><br><span></span><br><span>This patch is just a clean up that makes the index_of() code a little</span><br><span>bit less complex.</span><br><span></span><br>
<span>Signed-off-by: Steven Rostedt &lt;<a href="mailto:rostedt@goodmis.org" target="_blank">rostedt@goodmis.org</a>&gt;</span><br>
<span></span><br><span>diff --git a/mm/slab.c b/mm/slab.c</span><br><span>index 856e4a1..6047900 100644</span><br><span>--- a/mm/slab.c</span><br><span>+++ b/mm/slab.c</span><br><span>@@ -325,9 +325,7 @@ static void cache_reap(struct work_struct *unused);</span><br>

<span> static __always_inline int index_of(const size_t size)</span><br><span> {</span><br><span>     extern void __bad_size(void);</span><br><span>-</span><br><span>-    if (__builtin_constant_p(size)) {</span><br><span>-        int i = 0;</span><br>

<span>+    int i = 0;</span><br><span></span><br><span> #define CACHE(x) \</span><br><span>     if (size &lt;=x) \</span><br><span>@@ -336,9 +334,7 @@ static __always_inline int index_of(const size_t size)</span><br><span>         i++;</span><br>

<span> #include &lt;linux/kmalloc_sizes.h&gt;</span><br><span> #undef CACHE</span><br><span>-        __bad_size();</span><br><span>-    } else</span><br><span>-        __bad_size();</span><br><span>+    __bad_size();</span><br>

<span>     return 0;</span><br><span> }</span><br><span></span><br><span></span><br><span></span><br></div></blockquote></div>
<br>_______________________________________________<br>
LLVMLinux mailing list<br>
<a href="mailto:LLVMLinux@lists.linuxfoundation.org">LLVMLinux@lists.linuxfoundation.org</a><br>
<a href="https://lists.linuxfoundation.org/mailman/listinfo/llvmlinux" target="_blank">https://lists.linuxfoundation.org/mailman/listinfo/llvmlinux</a><br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr">
Simplicity is the ultimate sophistication<br></div>
</div>