Skip to contentSkip to conversation

add gfp_mask to page owner

PATCH New Alexander Nyberg 1 participant 1 message Mar 15, 2005

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 add gfp_mask to page owner

Hi Andrew

After looking at the recent memory leak thread I think it might have helped having the gfp mask of the allocated pages. This makes that available, no changes needed for the user-space sorter, same trace with different gfp masks will be in separate chunks.

Output looks like:

4819 times:
Page allocated via order 0, mask 0x50
[0xc012b7b9] find_lock_page+25
[0xc012b8c8] find_or_create_page+152
[0xc0147d74] grow_dev_page+36
[0xc0148164] __find_get_block+84
[0xc0147ebc] __getblk_slow+124
[0xc0148164] __find_get_block+84
[0xc01481e7] __getblk+55
[0xc0185d14] do_readahead+100

If you think it might be a good idea then here it is.

fs/proc/proc_misc.c +2 -1
Index: linux-2.6.11/fs/proc/proc_misc.c
===================================================================
@@ -571,7 +571,8 @@
 	if (!kbuf)
 		return -ENOMEM;
 
-	ret = snprintf(kbuf, 1024, "Page allocated via order %d\n", page->order);
+	ret = snprintf(kbuf, 1024, "Page allocated via order %d, mask 0x%x\n",
+			page->order, page->gfp_mask);
 
 	for (i = 0; i < 8; i++) {
 		if (!page->trace[i])
mm/page_alloc.c +1 -0
Index: linux-2.6.11/mm/page_alloc.c
===================================================================
@@ -1050,6 +1050,7 @@
 	asm ("movl %%ebp, %0" : "=r" (bp) : );
 #endif
 	page->order = (int) order;
+	page->gfp_mask = gfp_mask;
 	__stack_trace(page, &address, bp);
 	}
 #endif /* CONFIG_PAGE_OWNER */
include/linux/mm.h +1 -0
Index: linux-2.6.11/include/linux/mm.h
===================================================================
@@ -266,6 +266,7 @@
 #endif /* WANT_PAGE_VIRTUAL */
 #ifdef CONFIG_PAGE_OWNER
 	int order;
+	unsigned int gfp_mask;
 	unsigned long trace[8];
 #endif
 };