<div dir="auto"><div><br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, 20 May 2019, 6:54 am Tobin C. Harding, <me@tobin.cc> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Mon, May 20, 2019 at 05:37:41AM +0530, Amit Kumar wrote:<br>
> HI,<br>
> <br>
> mm/slub.c: line 3973<br>
> int __kmem_cache_shrink(struct kmem_cache *s)<br>
> {<br>
> int node;<br>
> int i;<br>
> struct kmem_cache_node *n;<br>
> struct page *page;<br>
> struct page *t;<br>
> struct list_head discard;<br>
> struct list_head promote[SHRINK_PROMOTE_MAX];<br>
> unsigned long flags;<br>
> int ret = 0;<br>
> <br>
> flush_all(s);<br>
> for_each_kmem_cache_node(s, node, n) {<br>
> <br>
> How uninitialized variable node is being used in macro for_each_kmem_cache_node?<br>
><br>
> node is a local variable with no extern and not initialized.<br>
> <br>
> mm/slab.h: line 490<br>
> #define for_each_kmem_cache_node(__s, __node, __n) \<br>
> for (__node = 0; __node < nr_node_ids; __node++) \<br>
<br>
This _is_ the initialization of node.  </blockquote></div></div><div dir="auto">First thank you for your reply.</div><div dir="auto">I just did not use my brain that node is initialized using __node inside for loop.</div><div dir="auto">I know well macros are literally replaced and do not exist anymore after preprocessing.</div><div dir="auto"><br></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Macros are kinda funky, there<br>
isn't much more to say about that other than perhaps read up some more<br>
about how macros work in C and read a bunch more macros in the kernel<br>
e.g. include/linux/list.h<br>
<br>
Good luck,<br>
Tobin.<br>
</blockquote></div></div></div>