diff options
Diffstat (limited to 'mm/memcontrol.c')
-rw-r--r-- | mm/memcontrol.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index d58bb5fa4403..c74102d6eb5a 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c | |||
@@ -3050,6 +3050,23 @@ void mem_cgroup_uncharge_end(void) | |||
3050 | batch->memcg = NULL; | 3050 | batch->memcg = NULL; |
3051 | } | 3051 | } |
3052 | 3052 | ||
3053 | /* | ||
3054 | * A function for resetting pc->mem_cgroup for newly allocated pages. | ||
3055 | * This function should be called if the newpage will be added to LRU | ||
3056 | * before start accounting. | ||
3057 | */ | ||
3058 | void mem_cgroup_reset_owner(struct page *newpage) | ||
3059 | { | ||
3060 | struct page_cgroup *pc; | ||
3061 | |||
3062 | if (mem_cgroup_disabled()) | ||
3063 | return; | ||
3064 | |||
3065 | pc = lookup_page_cgroup(newpage); | ||
3066 | VM_BUG_ON(PageCgroupUsed(pc)); | ||
3067 | pc->mem_cgroup = root_mem_cgroup; | ||
3068 | } | ||
3069 | |||
3053 | #ifdef CONFIG_SWAP | 3070 | #ifdef CONFIG_SWAP |
3054 | /* | 3071 | /* |
3055 | * called after __delete_from_swap_cache() and drop "page" account. | 3072 | * called after __delete_from_swap_cache() and drop "page" account. |