Update page->order at an appropriate time when tracking PAGE_OWNER
Subsystems (3)
PATCH 1/1 Update page->order at an appropriate time when tracking PAGE_OWNER
PAGE_OWNER tracks free pages by setting page->order to -1. However, it is set during __free_pages() which is not the only free path as __pagevec_free() and free_compound_page() do not go through __free_pages(). This leads to a situation where free pages are visible in /proc/page_owner which is confusing and might be interpreted as a memory leak.
This patch sets page->owner when PageBuddy is set. It also prints a warning to the kernel log if a free page is found that does not appear free to PAGE_OWNER. This should be considered a fix to page-owner-tracking-leak-detector.patch.
This only applies to -mm as PAGE_OWNER is not in mainline.
Signed-off-by Mel Gorman <[email protected]>
Acked-by Andy Whitcroft <[email protected]>
--- fs/proc/proc_misc.c | 8 ++++++++ mm/page_alloc.c | 6 +++--- 2 files changed, 11 insertions(+), 3 deletions(-)
fs/proc/proc_misc.c +8 -0
@@ -769,8 +769,16 @@ read_page_owner(struct file *file, charif (!pfn_valid (pfn))continue ; page =pfn_to_page (pfn); + +/* Catch situations where free pages have a bad ->order */ +if (page->order >=0 &&PageBuddy (page)) +printk (KERN_WARNING +"PageOwner info inaccurate for PFN %lu\n" , + pfn); +if (page->order >=0 )break ; + next_idx++; }
mm/page_alloc.c +3 -3
@@ -324,6 +324,9 @@ static inline void set_page_order(struct {set_page_private (page, order);__SetPageBuddy (page); +#ifdef CONFIG_PAGE_OWNER + page->order =-1 ; +#endif }static inline void rmv_page_order (struct page *page)
@@ -1745,9 +1748,6 @@ fastcall void __free_pages(struct page *free_hot_page (page); else__free_pages_ok (page ,order ); -#ifdef CONFIG_PAGE_OWNER - page->order =-1 ; -#endif } }
Signature · 9 lines
Mel Gorman Part-time Phd Student Linux Technology Center University of Limerick IBM Dublin Software Lab -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>