Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1803801imu; Tue, 6 Nov 2018 04:43:36 -0800 (PST) X-Google-Smtp-Source: AJdET5cpfBF/vBr7yMJcmnUSaePK3Ap6/a6dMb6c7E/wdD6mhcm3yD9moF20Wp5hxgz5nAyg4DNz X-Received: by 2002:aa7:83c2:: with SMTP id j2-v6mr26049807pfn.91.1541508216382; Tue, 06 Nov 2018 04:43:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541508216; cv=none; d=google.com; s=arc-20160816; b=giqh4ejthFqSztuWgIsQS6sv2ClBxGmp60fuk9AoK7rVpZCfNNhiL+MvJhlZCQF0S0 Lo71ObAfdTAhNaxzSHgdk95iSZ/DJohu6xSxMOC3pTfoGwlncoaXjNXQPsU7IImAf1UI 4sGFPVLfQ+FIUQkcj+VrTH4ZnSg2c3aXB52qk9/n0PgixGjrG9Y1UM+/L51fuLnsTx2T qyw8EcbwOiDKGqwnhlakoJqsLNpdAbOuEQzbECQ2Vc5guGlwc2L/oL+qtzsHirwwqZXJ WAFvpIoUUesaACMga6z9J2hf3rdHsmko+f7bmdPZoJOO1MR9SgLMO0UuITPBTGPELtdd obwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=ISHYPPkLMUKP9RIzFM3w9X2J4ohXRbCtufXkWy3xtkM=; b=BjTg0SCAfXzWEp2rOQ70o8OHrQg+mU3kbS2N7WQqpXbX3t6Rg63sj+we6hK5dCwFWg 5vbCWkY+SdgczQcKreuowSTUXQPRC93bLWwLF4pV3wpTKyRg7KiI388tGgZDfVJ1aS3J 9wU7LTz4l6tHjTXFMMzjCmOYvV3/OJP+03KPvczoopkKZJcV601P+3qjTVZniR3dbT7k 4aToIlcZIg/pAYf9HVYovfh7AXcF+HYBqLQ6syyhLhU+OqgmrC7nbabeBSCmDQxJZqbd R15kA1D/W0KV2G0Heh5cgZQTBsWxHolOYayJmPSdMQM5yj2+m5kuWlNfYLyzxp8yCXPI 9Cxw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id go17si7712982plb.266.2018.11.06.04.43.20; Tue, 06 Nov 2018 04:43:36 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388018AbeKFWHa (ORCPT + 99 others); Tue, 6 Nov 2018 17:07:30 -0500 Received: from mx2.suse.de ([195.135.220.15]:46326 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2387704AbeKFWH3 (ORCPT ); Tue, 6 Nov 2018 17:07:29 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id CF97BB62D; Tue, 6 Nov 2018 12:42:25 +0000 (UTC) Date: Tue, 6 Nov 2018 13:42:24 +0100 From: Michal Hocko To: Tetsuo Handa Cc: Johannes Weiner , linux-mm@kvack.org, David Rientjes , Andrew Morton , LKML Subject: Re: [RFC PATCH 2/2] memcg: do not report racy no-eligible OOM tasks Message-ID: <20181106124224.GM27423@dhcp22.suse.cz> References: <20181022071323.9550-1-mhocko@kernel.org> <20181022071323.9550-3-mhocko@kernel.org> <20181026142531.GA27370@cmpxchg.org> <20181026192551.GC18839@dhcp22.suse.cz> <20181026193304.GD18839@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue 06-11-18 18:44:43, Tetsuo Handa wrote: [...] > diff --git a/mm/memcontrol.c b/mm/memcontrol.c > index 6e1469b..a97648a 100644 > --- a/mm/memcontrol.c > +++ b/mm/memcontrol.c > @@ -1382,8 +1382,13 @@ static bool mem_cgroup_out_of_memory(struct mem_cgroup *memcg, gfp_t gfp_mask, > }; > bool ret; > > - mutex_lock(&oom_lock); > - ret = out_of_memory(&oc); > + if (mutex_lock_killable(&oom_lock)) > + return true; > + /* > + * A few threads which were not waiting at mutex_lock_killable() can > + * fail to bail out. Therefore, check again after holding oom_lock. > + */ > + ret = fatal_signal_pending(current) || out_of_memory(&oc); > mutex_unlock(&oom_lock); > return ret; > } If we are goging with a memcg specific thingy then I really prefer tsk_is_oom_victim approach. Or is there any reason why this is not suitable? -- Michal Hocko SUSE Labs