From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754375AbbE1SNM (ORCPT ); Thu, 28 May 2015 14:13:12 -0400 Received: from mail-wi0-f170.google.com ([209.85.212.170]:37484 "EHLO mail-wi0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753723AbbE1SNE (ORCPT ); Thu, 28 May 2015 14:13:04 -0400 Date: Thu, 28 May 2015 20:13:02 +0200 From: Michal Hocko To: Vladimir Davydov Cc: Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Johannes Weiner Subject: Re: [PATCH] memcg: do not call reclaim if !__GFP_WAIT Message-ID: <20150528181301.GC2321@dhcp22.suse.cz> References: <1432833966-25538-1-git-send-email-vdavydov@parallels.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1432833966-25538-1-git-send-email-vdavydov@parallels.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu 28-05-15 20:26:06, Vladimir Davydov wrote: > 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. > Fixes: 241994ed8649 ("mm: memcontrol: default hierarchy interface for memory") And I would make it for stable 4.0 > Signed-off-by: Vladimir Davydov > Cc: Johannes Weiner > Cc: Michal Hocko Acked-by: Michal Hocko Thanks! > --- > 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 > -- Michal Hocko SUSE Labs