try_to_free_pages may sleep.

Signed-off-by: Vladimir Davydov <[email protected]>
---
 mm/memcontrol.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 6409fb28f00b..92928937f900 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -2800,6 +2800,8 @@ static int mem_cgroup_do_charge(struct mem_cgroup *memcg, 
gfp_t gfp_mask,
        return CHARGE_RETRY;
 
 done:
+       if (!(gfp_mask & __GFP_WAIT))
+               goto out;
        /*
         * If the hierarchy is above the normal consumption range,
         * make the charging task trim their excess contribution.
@@ -2809,6 +2811,7 @@ done:
                        continue;
                try_to_free_mem_cgroup_pages(memcg, nr_pages, gfp_mask, false);
        } while ((memcg = parent_mem_cgroup(memcg)));
+out:
        return CHARGE_OK;
 }
 
-- 
2.1.4

_______________________________________________
Devel mailing list
[email protected]
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to