[PATCH] add gfp_mask to page owner

From: Alexander Nyberg
Date: Tue Mar 15 2005 - 14:33:34 EST


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.


Index: linux-2.6.11/fs/proc/proc_misc.c
===================================================================
--- linux-2.6.11.orig/fs/proc/proc_misc.c 2005-03-15 21:13:43.000000000 +0100
+++ linux-2.6.11/fs/proc/proc_misc.c 2005-03-15 21:17:20.000000000 +0100
@@ -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])
Index: linux-2.6.11/mm/page_alloc.c
===================================================================
--- linux-2.6.11.orig/mm/page_alloc.c 2005-03-15 21:13:43.000000000 +0100
+++ linux-2.6.11/mm/page_alloc.c 2005-03-15 21:14:32.000000000 +0100
@@ -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 */
Index: linux-2.6.11/include/linux/mm.h
===================================================================
--- linux-2.6.11.orig/include/linux/mm.h 2005-03-15 21:13:43.000000000 +0100
+++ linux-2.6.11/include/linux/mm.h 2005-03-15 21:14:32.000000000 +0100
@@ -266,6 +266,7 @@
#endif /* WANT_PAGE_VIRTUAL */
#ifdef CONFIG_PAGE_OWNER
int order;
+ unsigned int gfp_mask;
unsigned long trace[8];
#endif
};




-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/