Kernel Newbies archive on
 help / color / Atom feed
* Unable to understand a piece of code
@ 2019-05-20  0:07 Amit Kumar
  2019-05-20  1:23 ` Tobin C. Harding
  2019-05-22 17:57 ` Máté Eckl
  0 siblings, 2 replies; 4+ messages in thread
From: Amit Kumar @ 2019-05-20  0:07 UTC (permalink / raw)
  To: linux-newbie, Kernel Newbies


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;

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.

Amit Kumar

Kernelnewbies mailing list

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, back to index

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-20  0:07 Unable to understand a piece of code Amit Kumar
2019-05-20  1:23 ` Tobin C. Harding
2019-05-20  3:33   ` Amit Kumar
2019-05-22 17:57 ` Máté Eckl

Kernel Newbies archive on

Archives are clonable:
	git clone --mirror kernelnewbies/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 kernelnewbies kernelnewbies/ \
	public-inbox-index kernelnewbies

Newsgroup available over NNTP:

AGPL code for this site: git clone public-inbox