Unable to understand a piece of code

Amit Kumar <[email protected]> Mon, 20 May 2019 05:37:41 +0530
Newsgroups gmane.linux.kernel.kernelnewbies,gmane.linux.newbie
Message-ID <CAPTh4Ouvn=SiGnUGV5B7Drmp2-tVCMV=Z46+t-XL5rqPcTpF-g@mail.gmail.com>
HI,

mm/slub.c: line 3973
int __kmem_cache_shrink(struct kmem_cache *s)
{
int node;
int i;
struct kmem_cache_node *n;
struct page *page;
struct page *t;
struct list_head discard;
struct list_head promote[SHRINK_PROMOTE_MAX];
unsigned long flags;
int ret = 0;

flush_all(s);
for_each_kmem_cache_node(s, node, n) {

How uninitialized variable node is being used in macro for_each_kmem_cache_node?

node is a local variable with no extern and not initialized.

mm/slab.h: line 490
#define for_each_kmem_cache_node(__s, __node, __n) \
for (__node = 0; __node < nr_node_ids; __node++) \
if ((__n = get_node(__s, __node)))

As we see for loop is based on node.

Thanks in advance.

Regards,
Amit Kumar