diff options
-rw-r--r-- | include/linux/memcontrol.h | 6 | ||||
-rw-r--r-- | mm/memcontrol.c | 14 | ||||
-rw-r--r-- | mm/vmscan.c | 4 |
3 files changed, 15 insertions, 9 deletions
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index 4b78661c68d0..d8dd6560621b 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h | |||
@@ -180,7 +180,8 @@ static inline void mem_cgroup_dec_page_stat(struct page *page, | |||
180 | mem_cgroup_update_page_stat(page, idx, -1); | 180 | mem_cgroup_update_page_stat(page, idx, -1); |
181 | } | 181 | } |
182 | 182 | ||
183 | bool mem_cgroup_soft_reclaim_eligible(struct mem_cgroup *memcg); | 183 | bool mem_cgroup_soft_reclaim_eligible(struct mem_cgroup *memcg, |
184 | struct mem_cgroup *root); | ||
184 | 185 | ||
185 | void __mem_cgroup_count_vm_event(struct mm_struct *mm, enum vm_event_item idx); | 186 | void __mem_cgroup_count_vm_event(struct mm_struct *mm, enum vm_event_item idx); |
186 | static inline void mem_cgroup_count_vm_event(struct mm_struct *mm, | 187 | static inline void mem_cgroup_count_vm_event(struct mm_struct *mm, |
@@ -357,7 +358,8 @@ static inline void mem_cgroup_dec_page_stat(struct page *page, | |||
357 | } | 358 | } |
358 | 359 | ||
359 | static inline | 360 | static inline |
360 | bool mem_cgroup_soft_reclaim_eligible(struct mem_cgroup *memcg) | 361 | bool mem_cgroup_soft_reclaim_eligible(struct mem_cgroup *memcg, |
362 | struct mem_cgroup *root) | ||
361 | { | 363 | { |
362 | return false; | 364 | return false; |
363 | } | 365 | } |
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 87a448dd9c10..c016e001c5b2 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c | |||
@@ -1773,11 +1773,13 @@ int mem_cgroup_select_victim_node(struct mem_cgroup *memcg) | |||
1773 | #endif | 1773 | #endif |
1774 | 1774 | ||
1775 | /* | 1775 | /* |
1776 | * A group is eligible for the soft limit reclaim if it is | 1776 | * A group is eligible for the soft limit reclaim under the given root |
1777 | * a) is over its soft limit | 1777 | * hierarchy if |
1778 | * a) it is over its soft limit | ||
1778 | * b) any parent up the hierarchy is over its soft limit | 1779 | * b) any parent up the hierarchy is over its soft limit |
1779 | */ | 1780 | */ |
1780 | bool mem_cgroup_soft_reclaim_eligible(struct mem_cgroup *memcg) | 1781 | bool mem_cgroup_soft_reclaim_eligible(struct mem_cgroup *memcg, |
1782 | struct mem_cgroup *root) | ||
1781 | { | 1783 | { |
1782 | struct mem_cgroup *parent = memcg; | 1784 | struct mem_cgroup *parent = memcg; |
1783 | 1785 | ||
@@ -1785,12 +1787,14 @@ bool mem_cgroup_soft_reclaim_eligible(struct mem_cgroup *memcg) | |||
1785 | return true; | 1787 | return true; |
1786 | 1788 | ||
1787 | /* | 1789 | /* |
1788 | * If any parent up the hierarchy is over its soft limit then we | 1790 | * If any parent up to the root in the hierarchy is over its soft limit |
1789 | * have to obey and reclaim from this group as well. | 1791 | * then we have to obey and reclaim from this group as well. |
1790 | */ | 1792 | */ |
1791 | while((parent = parent_mem_cgroup(parent))) { | 1793 | while((parent = parent_mem_cgroup(parent))) { |
1792 | if (res_counter_soft_limit_excess(&parent->res)) | 1794 | if (res_counter_soft_limit_excess(&parent->res)) |
1793 | return true; | 1795 | return true; |
1796 | if (parent == root) | ||
1797 | break; | ||
1794 | } | 1798 | } |
1795 | 1799 | ||
1796 | return false; | 1800 | return false; |
diff --git a/mm/vmscan.c b/mm/vmscan.c index cf4643807ec2..1896e7ca494b 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c | |||
@@ -142,7 +142,7 @@ static bool global_reclaim(struct scan_control *sc) | |||
142 | 142 | ||
143 | static bool mem_cgroup_should_soft_reclaim(struct scan_control *sc) | 143 | static bool mem_cgroup_should_soft_reclaim(struct scan_control *sc) |
144 | { | 144 | { |
145 | return !mem_cgroup_disabled() && global_reclaim(sc); | 145 | return !mem_cgroup_disabled(); |
146 | } | 146 | } |
147 | #else | 147 | #else |
148 | static bool global_reclaim(struct scan_control *sc) | 148 | static bool global_reclaim(struct scan_control *sc) |
@@ -2161,7 +2161,7 @@ __shrink_zone(struct zone *zone, struct scan_control *sc, bool soft_reclaim) | |||
2161 | struct lruvec *lruvec; | 2161 | struct lruvec *lruvec; |
2162 | 2162 | ||
2163 | if (soft_reclaim && | 2163 | if (soft_reclaim && |
2164 | !mem_cgroup_soft_reclaim_eligible(memcg)) { | 2164 | !mem_cgroup_soft_reclaim_eligible(memcg, root)) { |
2165 | memcg = mem_cgroup_iter(root, memcg, &reclaim); | 2165 | memcg = mem_cgroup_iter(root, memcg, &reclaim); |
2166 | continue; | 2166 | continue; |
2167 | } | 2167 | } |