forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
mm/page_owner: keep track of page owners
This is the page owner tracking code which is introduced so far ago. It is resident on Andrew's tree, though, nobody tried to upstream so it remain as is. Our company uses this feature actively to debug memory leak or to find a memory hogger so I decide to upstream this feature. This functionality help us to know who allocates the page. When allocating a page, we store some information about allocation in extra memory. Later, if we need to know status of all pages, we can get and analyze it from this stored information. In previous version of this feature, extra memory is statically defined in struct page, but, in this version, extra memory is allocated outside of struct page. It enables us to turn on/off this feature at boottime without considerable memory waste. Although we already have tracepoint for tracing page allocation/free, using it to analyze page owner is rather complex. We need to enlarge the trace buffer for preventing overlapping until userspace program launched. And, launched program continually dump out the trace buffer for later analysis and it would change system behaviour with more possibility rather than just keeping it in memory, so bad for debug. Moreover, we can use page_owner feature further for various purposes. For example, we can use it for fragmentation statistics implemented in this patch. And, I also plan to implement some CMA failure debugging feature using this interface. I'd like to give the credit for all developers contributed this feature, but, it's not easy because I don't know exact history. Sorry about that. Below is people who has "Signed-off-by" in the patches in Andrew's tree. Contributor: Alexander Nyberg <[email protected]> Mel Gorman <[email protected]> Dave Hansen <[email protected]> Minchan Kim <[email protected]> Michal Nazarewicz <[email protected]> Andrew Morton <[email protected]> Jungsoo Son <[email protected]> Signed-off-by: Joonsoo Kim <[email protected]> Cc: Mel Gorman <[email protected]> Cc: Johannes Weiner <[email protected]> Cc: Minchan Kim <[email protected]> Cc: Dave Hansen <[email protected]> Cc: Michal Nazarewicz <[email protected]> Cc: Jungsoo Son <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Joonsoo Kim <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
- Loading branch information
1 parent
9a92a6c
commit 48c96a3
Showing
11 changed files
with
554 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#ifndef __LINUX_PAGE_OWNER_H | ||
#define __LINUX_PAGE_OWNER_H | ||
|
||
#ifdef CONFIG_PAGE_OWNER | ||
extern bool page_owner_inited; | ||
extern struct page_ext_operations page_owner_ops; | ||
|
||
extern void __reset_page_owner(struct page *page, unsigned int order); | ||
extern void __set_page_owner(struct page *page, | ||
unsigned int order, gfp_t gfp_mask); | ||
|
||
static inline void reset_page_owner(struct page *page, unsigned int order) | ||
{ | ||
if (likely(!page_owner_inited)) | ||
return; | ||
|
||
__reset_page_owner(page, order); | ||
} | ||
|
||
static inline void set_page_owner(struct page *page, | ||
unsigned int order, gfp_t gfp_mask) | ||
{ | ||
if (likely(!page_owner_inited)) | ||
return; | ||
|
||
__set_page_owner(page, order, gfp_mask); | ||
} | ||
#else | ||
static inline void reset_page_owner(struct page *page, unsigned int order) | ||
{ | ||
} | ||
static inline void set_page_owner(struct page *page, | ||
unsigned int order, gfp_t gfp_mask) | ||
{ | ||
} | ||
|
||
#endif /* CONFIG_PAGE_OWNER */ | ||
#endif /* __LINUX_PAGE_OWNER_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.