From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754067AbbE1R0Z (ORCPT ); Thu, 28 May 2015 13:26:25 -0400 Received: from mx2.parallels.com ([199.115.105.18]:57615 "EHLO mx2.parallels.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752810AbbE1R0R (ORCPT ); Thu, 28 May 2015 13:26:17 -0400 From: Vladimir Davydov To: Andrew Morton CC: , , Johannes Weiner , Michal Hocko Subject: [PATCH] memcg: do not call reclaim if !__GFP_WAIT Date: Thu, 28 May 2015 20:26:06 +0300 Message-ID: <1432833966-25538-1-git-send-email-vdavydov@parallels.com> X-Mailer: git-send-email 2.1.4 MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When trimming memcg consumption excess (see memory.high), we call try_to_free_mem_cgroup_pages without checking if we are allowed to sleep in the current context, which can result in a deadlock. Fix this. Signed-off-by: Vladimir Davydov Cc: Johannes Weiner Cc: Michal Hocko --- mm/memcontrol.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 14c2f2017e37..9da23a7ec4c0 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -2323,6 +2323,8 @@ done_restock: css_get_many(&memcg->css, batch); if (batch > nr_pages) refill_stock(memcg, batch - nr_pages); + if (!(gfp_mask & __GFP_WAIT)) + goto done; /* * If the hierarchy is above the normal consumption range, * make the charging task trim their excess contribution. -- 2.1.4