mem_cgroup_update_page_stat(page, idx, -1);
 }
 
-bool mem_cgroup_soft_reclaim_eligible(struct mem_cgroup *memcg);
+bool mem_cgroup_soft_reclaim_eligible(struct mem_cgroup *memcg,
+               struct mem_cgroup *root);
 
 void __mem_cgroup_count_vm_event(struct mm_struct *mm, enum vm_event_item idx);
 static inline void mem_cgroup_count_vm_event(struct mm_struct *mm,
 }
 
 static inline
-bool mem_cgroup_soft_reclaim_eligible(struct mem_cgroup *memcg)
+bool mem_cgroup_soft_reclaim_eligible(struct mem_cgroup *memcg,
+               struct mem_cgroup *root)
 {
        return false;
 }
 
 #endif
 
 /*
- * A group is eligible for the soft limit reclaim if it is
- *     a) is over its soft limit
+ * A group is eligible for the soft limit reclaim under the given root
+ * hierarchy if
+ *     a) it is over its soft limit
  *     b) any parent up the hierarchy is over its soft limit
  */
-bool mem_cgroup_soft_reclaim_eligible(struct mem_cgroup *memcg)
+bool mem_cgroup_soft_reclaim_eligible(struct mem_cgroup *memcg,
+               struct mem_cgroup *root)
 {
        struct mem_cgroup *parent = memcg;
 
                return true;
 
        /*
-        * If any parent up the hierarchy is over its soft limit then we
-        * have to obey and reclaim from this group as well.
+        * If any parent up to the root in the hierarchy is over its soft limit
+        * then we have to obey and reclaim from this group as well.
         */
        while((parent = parent_mem_cgroup(parent))) {
                if (res_counter_soft_limit_excess(&parent->res))
                        return true;
+               if (parent == root)
+                       break;
        }
 
        return false;
 
 
 static bool mem_cgroup_should_soft_reclaim(struct scan_control *sc)
 {
-       return !mem_cgroup_disabled() && global_reclaim(sc);
+       return !mem_cgroup_disabled();
 }
 #else
 static bool global_reclaim(struct scan_control *sc)
                        struct lruvec *lruvec;
 
                        if (soft_reclaim &&
-                           !mem_cgroup_soft_reclaim_eligible(memcg)) {
+                           !mem_cgroup_soft_reclaim_eligible(memcg, root)) {
                                memcg = mem_cgroup_iter(root, memcg, &reclaim);
                                continue;
                        }