Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2924087imu; Wed, 7 Nov 2018 01:46:29 -0800 (PST) X-Google-Smtp-Source: AJdET5fi44h3B5EjJQN+v87V2Ghs+rSxAJ6OS40g8RGUDS2e3NYXuW1H19uazVLHZ3kBOGDvpcZ9 X-Received: by 2002:a17:902:e81:: with SMTP id 1-v6mr1252360plx.48.1541583989791; Wed, 07 Nov 2018 01:46:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541583989; cv=none; d=google.com; s=arc-20160816; b=JBmw+PhyhxRLgmHwSM0aNV+9lnqFDgB1Fx1FhaQdDzoYft622me1srU2zCmYGg/VxJ zrKUQ8dZbt4U7WYjgUmd6JAhZG2aXgQS0QxB871yRLVen3ShgZI71CCD20Dq8sUxD13x bfkvARBkQXpE56gkzfBc2Dx8JzXFOitMyFLB9wYz5FNeRVTYXin9ILPmhyRP+KLAARSF KWVch217eTqJthk3/QjP1U8eGCXYVxxrmDmpwAVz+B21e1BzcgwtnroE6v/vJwFubfjS mI2L921jR56+ZNhBfkM7uNNxPAgkXfSi+BNrUUb5j4TI/kySwvRioLK2jvKCHYbt5UrC AzzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=iqMleRZgn6gq3jtxj8sWHYLB0eRQY46mrOpzvI/UCaE=; b=TsS75VTdyEPiLq1TNsCXG38r54eLzQWUwmftRSeixguNRT+VY9bpG+89BCgAs+2/+D hC2pdok9XAYZ5fLK1wRzADsDtHIwbF3DVEdiySt6sLx1jW+fK3xthrlStPNhLLBEShNa qsClbJ/u5SrsTmbZq4MAn5+Gz5w75yJgD4hFABiSF4FV5u4teuyf2aiWld4jWhtVa8an orGHPTTKHM3VWFsBtqWrEaEE5ua1odDTERaiSoK3d80kWGDKZl0s5o0fkoh6xQHE0MDU NWVZMJWrm7iRHcAKoUrPHqVZSr0qomi0Iaxu/nL0lZQodWgmx4+1CT7fdZEvx8G51DhC ji4A== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n78-v6si113650pfi.171.2018.11.07.01.46.14; Wed, 07 Nov 2018 01:46:29 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730526AbeKGTPU (ORCPT + 99 others); Wed, 7 Nov 2018 14:15:20 -0500 Received: from www262.sakura.ne.jp ([202.181.97.72]:59963 "EHLO www262.sakura.ne.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726223AbeKGTPU (ORCPT ); Wed, 7 Nov 2018 14:15:20 -0500 Received: from fsav104.sakura.ne.jp (fsav104.sakura.ne.jp [27.133.134.231]) by www262.sakura.ne.jp (8.15.2/8.15.2) with ESMTP id wA79jW3r096815; Wed, 7 Nov 2018 18:45:32 +0900 (JST) (envelope-from penguin-kernel@i-love.sakura.ne.jp) Received: from www262.sakura.ne.jp (202.181.97.72) by fsav104.sakura.ne.jp (F-Secure/fsigk_smtp/530/fsav104.sakura.ne.jp); Wed, 07 Nov 2018 18:45:32 +0900 (JST) X-Virus-Status: clean(F-Secure/fsigk_smtp/530/fsav104.sakura.ne.jp) Received: from [192.168.1.8] (softbank060157065137.bbtec.net [60.157.65.137]) (authenticated bits=0) by www262.sakura.ne.jp (8.15.2/8.15.2) with ESMTPSA id wA79jSm9096790 (version=TLSv1.2 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 7 Nov 2018 18:45:32 +0900 (JST) (envelope-from penguin-kernel@i-love.sakura.ne.jp) Subject: Re: [RFC PATCH 2/2] memcg: do not report racy no-eligible OOM tasks To: Michal Hocko Cc: Johannes Weiner , linux-mm@kvack.org, David Rientjes , Andrew Morton , LKML 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> <20181106124224.GM27423@dhcp22.suse.cz> From: Tetsuo Handa Message-ID: <8725e3b3-3752-fa7f-a88f-5ff4f5b6eace@i-love.sakura.ne.jp> Date: Wed, 7 Nov 2018 18:45:27 +0900 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20181106124224.GM27423@dhcp22.suse.cz> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018/11/06 21:42, Michal Hocko wrote: > 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? > Why need to wait for mark_oom_victim() called after slow printk() messages? If current thread got Ctrl-C and thus current thread can terminate, what is nice with waiting for the OOM killer? If there are several OOM events in multiple memcg domains waiting for completion of printk() messages? I don't see points with waiting for oom_lock, for try_charge() already allows current thread to terminate due to fatal_signal_pending() test.