diff options
Diffstat (limited to 'mm/memory.c')
-rw-r--r-- | mm/memory.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/mm/memory.c b/mm/memory.c index 3f8fa06b963b..7f210f160990 100644 --- a/mm/memory.c +++ b/mm/memory.c | |||
@@ -2000,7 +2000,7 @@ gotten: | |||
2000 | cow_user_page(new_page, old_page, address, vma); | 2000 | cow_user_page(new_page, old_page, address, vma); |
2001 | __SetPageUptodate(new_page); | 2001 | __SetPageUptodate(new_page); |
2002 | 2002 | ||
2003 | if (mem_cgroup_charge(new_page, mm, GFP_KERNEL)) | 2003 | if (mem_cgroup_newpage_charge(new_page, mm, GFP_KERNEL)) |
2004 | goto oom_free_new; | 2004 | goto oom_free_new; |
2005 | 2005 | ||
2006 | /* | 2006 | /* |
@@ -2392,6 +2392,7 @@ static int do_swap_page(struct mm_struct *mm, struct vm_area_struct *vma, | |||
2392 | struct page *page; | 2392 | struct page *page; |
2393 | swp_entry_t entry; | 2393 | swp_entry_t entry; |
2394 | pte_t pte; | 2394 | pte_t pte; |
2395 | struct mem_cgroup *ptr = NULL; | ||
2395 | int ret = 0; | 2396 | int ret = 0; |
2396 | 2397 | ||
2397 | if (!pte_unmap_same(mm, pmd, page_table, orig_pte)) | 2398 | if (!pte_unmap_same(mm, pmd, page_table, orig_pte)) |
@@ -2430,7 +2431,7 @@ static int do_swap_page(struct mm_struct *mm, struct vm_area_struct *vma, | |||
2430 | lock_page(page); | 2431 | lock_page(page); |
2431 | delayacct_clear_flag(DELAYACCT_PF_SWAPIN); | 2432 | delayacct_clear_flag(DELAYACCT_PF_SWAPIN); |
2432 | 2433 | ||
2433 | if (mem_cgroup_charge(page, mm, GFP_KERNEL)) { | 2434 | if (mem_cgroup_try_charge(mm, GFP_KERNEL, &ptr) == -ENOMEM) { |
2434 | ret = VM_FAULT_OOM; | 2435 | ret = VM_FAULT_OOM; |
2435 | unlock_page(page); | 2436 | unlock_page(page); |
2436 | goto out; | 2437 | goto out; |
@@ -2460,6 +2461,7 @@ static int do_swap_page(struct mm_struct *mm, struct vm_area_struct *vma, | |||
2460 | flush_icache_page(vma, page); | 2461 | flush_icache_page(vma, page); |
2461 | set_pte_at(mm, address, page_table, pte); | 2462 | set_pte_at(mm, address, page_table, pte); |
2462 | page_add_anon_rmap(page, vma, address); | 2463 | page_add_anon_rmap(page, vma, address); |
2464 | mem_cgroup_commit_charge_swapin(page, ptr); | ||
2463 | 2465 | ||
2464 | swap_free(entry); | 2466 | swap_free(entry); |
2465 | if (vm_swap_full() || (vma->vm_flags & VM_LOCKED) || PageMlocked(page)) | 2467 | if (vm_swap_full() || (vma->vm_flags & VM_LOCKED) || PageMlocked(page)) |
@@ -2480,7 +2482,7 @@ unlock: | |||
2480 | out: | 2482 | out: |
2481 | return ret; | 2483 | return ret; |
2482 | out_nomap: | 2484 | out_nomap: |
2483 | mem_cgroup_uncharge_page(page); | 2485 | mem_cgroup_cancel_charge_swapin(ptr); |
2484 | pte_unmap_unlock(page_table, ptl); | 2486 | pte_unmap_unlock(page_table, ptl); |
2485 | unlock_page(page); | 2487 | unlock_page(page); |
2486 | page_cache_release(page); | 2488 | page_cache_release(page); |
@@ -2510,7 +2512,7 @@ static int do_anonymous_page(struct mm_struct *mm, struct vm_area_struct *vma, | |||
2510 | goto oom; | 2512 | goto oom; |
2511 | __SetPageUptodate(page); | 2513 | __SetPageUptodate(page); |
2512 | 2514 | ||
2513 | if (mem_cgroup_charge(page, mm, GFP_KERNEL)) | 2515 | if (mem_cgroup_newpage_charge(page, mm, GFP_KERNEL)) |
2514 | goto oom_free_page; | 2516 | goto oom_free_page; |
2515 | 2517 | ||
2516 | entry = mk_pte(page, vma->vm_page_prot); | 2518 | entry = mk_pte(page, vma->vm_page_prot); |
@@ -2601,7 +2603,7 @@ static int __do_fault(struct mm_struct *mm, struct vm_area_struct *vma, | |||
2601 | ret = VM_FAULT_OOM; | 2603 | ret = VM_FAULT_OOM; |
2602 | goto out; | 2604 | goto out; |
2603 | } | 2605 | } |
2604 | if (mem_cgroup_charge(page, mm, GFP_KERNEL)) { | 2606 | if (mem_cgroup_newpage_charge(page, mm, GFP_KERNEL)) { |
2605 | ret = VM_FAULT_OOM; | 2607 | ret = VM_FAULT_OOM; |
2606 | page_cache_release(page); | 2608 | page_cache_release(page); |
2607 | goto out; | 2609 | goto out; |