diff options
Diffstat (limited to 'mm/memcontrol.c')
-rw-r--r-- | mm/memcontrol.c | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 83ba13ad31e1..1333d25163bb 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c | |||
@@ -697,20 +697,22 @@ int mem_cgroup_cache_charge(struct page *page, struct mm_struct *mm, | |||
697 | 697 | ||
698 | /* | 698 | /* |
699 | * Uncharging is always a welcome operation, we never complain, simply | 699 | * Uncharging is always a welcome operation, we never complain, simply |
700 | * uncharge. This routine should be called with lock_page_cgroup held | 700 | * uncharge. |
701 | */ | 701 | */ |
702 | void mem_cgroup_uncharge(struct page_cgroup *pc) | 702 | void mem_cgroup_uncharge_page(struct page *page) |
703 | { | 703 | { |
704 | struct page_cgroup *pc; | ||
704 | struct mem_cgroup *mem; | 705 | struct mem_cgroup *mem; |
705 | struct mem_cgroup_per_zone *mz; | 706 | struct mem_cgroup_per_zone *mz; |
706 | struct page *page; | ||
707 | unsigned long flags; | 707 | unsigned long flags; |
708 | 708 | ||
709 | /* | 709 | /* |
710 | * Check if our page_cgroup is valid | 710 | * Check if our page_cgroup is valid |
711 | */ | 711 | */ |
712 | lock_page_cgroup(page); | ||
713 | pc = page_get_page_cgroup(page); | ||
712 | if (!pc) | 714 | if (!pc) |
713 | return; | 715 | goto unlock; |
714 | 716 | ||
715 | if (atomic_dec_and_test(&pc->ref_cnt)) { | 717 | if (atomic_dec_and_test(&pc->ref_cnt)) { |
716 | page = pc->page; | 718 | page = pc->page; |
@@ -731,12 +733,8 @@ void mem_cgroup_uncharge(struct page_cgroup *pc) | |||
731 | } | 733 | } |
732 | lock_page_cgroup(page); | 734 | lock_page_cgroup(page); |
733 | } | 735 | } |
734 | } | ||
735 | 736 | ||
736 | void mem_cgroup_uncharge_page(struct page *page) | 737 | unlock: |
737 | { | ||
738 | lock_page_cgroup(page); | ||
739 | mem_cgroup_uncharge(page_get_page_cgroup(page)); | ||
740 | unlock_page_cgroup(page); | 738 | unlock_page_cgroup(page); |
741 | } | 739 | } |
742 | 740 | ||
@@ -759,12 +757,7 @@ int mem_cgroup_prepare_migration(struct page *page) | |||
759 | 757 | ||
760 | void mem_cgroup_end_migration(struct page *page) | 758 | void mem_cgroup_end_migration(struct page *page) |
761 | { | 759 | { |
762 | struct page_cgroup *pc; | 760 | mem_cgroup_uncharge_page(page); |
763 | |||
764 | lock_page_cgroup(page); | ||
765 | pc = page_get_page_cgroup(page); | ||
766 | mem_cgroup_uncharge(pc); | ||
767 | unlock_page_cgroup(page); | ||
768 | } | 761 | } |
769 | /* | 762 | /* |
770 | * We know both *page* and *newpage* are now not-on-LRU and Pg_locked. | 763 | * We know both *page* and *newpage* are now not-on-LRU and Pg_locked. |