Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp829822imm; Tue, 3 Jul 2018 00:18:10 -0700 (PDT) X-Google-Smtp-Source: AAOMgpd8l/mk88P5FWwpUFEgyaEz5CYrD8oJGVfk5RdBsjtgiNtb5SHybvhcuu3u1AB8ibPSPfLf X-Received: by 2002:a63:6949:: with SMTP id e70-v6mr19418400pgc.119.1530602290678; Tue, 03 Jul 2018 00:18:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530602290; cv=none; d=google.com; s=arc-20160816; b=a8QJCQYW+z4lM7UxOyHPtrAcU6Gv1naq2J8O3D1pdh4e5q93Wc64zsRqD5USGtIGnh ahTUNRep+NWEspl1c6c7N6L3OIdkNc0os5dL9amQsuAwb+LOYSw+ubTOALS9k5ciEytM Pd0SS0Vf3lNCj+wafX1bjdoaAjn2ESgOx5pE7J/iADgMMNGTo2lSdiAibmu17+uvm8Vb l1d2p9tDv1wkgHOOsXSY+fLBwnhvl6Wwf0Af372W1Wscr0yTOhO1pYTrj2XQh5vHBLft Og8BpFhYkJUBiz7y4Id1HYAaaLPf+wbCl5Yqix4UkGxZeK865trMajaM71HswPl1/MHk WRmQ== 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:arc-authentication-results; bh=nXYvkzavoOIyuovSzLH3Af+46u8St6RuGMKs7Zv5Us0=; b=UayfdAXUmO8dp3IAunWAH4+vwnyfnB01E1G/0kQESVaZ5HpEjNEkKUtuQbtHlgSvrH 5J0T26CNPa87dqhIepvRLI0B/yOjhY4GMSZR9Bdc5mnT7ryGjCABSKRpd8F86y+h07sm SEA/x5BbvMkl5F21ILVcZgnM18GSr3RkNVgdeQOixnQRPHYxCJYP/roC6KGkQFtndd1j bXBdptAU712mQCy8OoUj5vYVD/TOwOCHsJ7jXRosEJIDaz0SEwvRRXzkJXsLX1O21tF9 5ATdVTN2Mf+srr15MvhTJz6xLE5lUg/8NGt9wVvZBkPOB61sa4xvjaJWuluPhluouvTn DkQw== 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 136-v6si439511pgb.587.2018.07.03.00.17.56; Tue, 03 Jul 2018 00:18:10 -0700 (PDT) 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 S1754488AbeGCHRB (ORCPT + 99 others); Tue, 3 Jul 2018 03:17:01 -0400 Received: from mx2.suse.de ([195.135.220.15]:39656 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753770AbeGCHRA (ORCPT ); Tue, 3 Jul 2018 03:17:00 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 4F81DADE3; Tue, 3 Jul 2018 07:16:59 +0000 (UTC) Date: Tue, 3 Jul 2018 09:16:58 +0200 From: Michal Hocko To: Greg Thelen Cc: Andrew Morton , Johannes Weiner , Shakeel Butt , linux-mm@kvack.org, LKML Subject: Re: [PATCH] memcg, oom: move out_of_memory back to the charge path Message-ID: <20180703071658.GC16767@dhcp22.suse.cz> References: <20180628151101.25307-1-mhocko@kernel.org> <20180629072132.GA13860@dhcp22.suse.cz> <20180702100301.GC19043@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.0 (2018-05-17) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue 03-07-18 00:08:05, Greg Thelen wrote: > Michal Hocko wrote: > > > On Fri 29-06-18 11:59:04, Greg Thelen wrote: > >> Michal Hocko wrote: > >> > >> > On Thu 28-06-18 16:19:07, Greg Thelen wrote: > >> >> Michal Hocko wrote: > >> > [...] > >> >> > + if (mem_cgroup_out_of_memory(memcg, mask, order)) > >> >> > + return OOM_SUCCESS; > >> >> > + > >> >> > + WARN(1,"Memory cgroup charge failed because of no reclaimable memory! " > >> >> > + "This looks like a misconfiguration or a kernel bug."); > >> >> > >> >> I'm not sure here if the warning should here or so strongly worded. It > >> >> seems like the current task could be oom reaped with MMF_OOM_SKIP and > >> >> thus mem_cgroup_out_of_memory() will return false. So there's nothing > >> >> alarming in that case. > >> > > >> > If the task is reaped then its charges should be released as well and > >> > that means that we should get below the limit. Sure there is some room > >> > for races but this should be still unlikely. Maybe I am just > >> > underestimating though. > >> > > >> > What would you suggest instead? > >> > >> I suggest checking MMF_OOM_SKIP or deleting the warning. > > > > So what do you do when you have MMF_OOM_SKIP task? Do not warn? Checking > > for all the tasks would be quite expensive and remembering that from the > > task selection not nice either. Why do you think it would help much? > > I assume we could just check current's MMF_OOM_SKIP - no need to check > all tasks. I still do not follow. If you are after a single task memcg then we should be ok. try_charge has a runaway for oom victims if (unlikely(tsk_is_oom_victim(current) || fatal_signal_pending(current) || current->flags & PF_EXITING)) goto force; regardless of MMF_OOM_SKIP. So if there is a single process in the memcg, we kill it and the oom reaper kicks in and sets MMF_OOM_SKIP then we should bail out there. Or do I miss your intention? > My only (minor) objection is that the warning text suggests > misconfiguration or kernel bug, when there may be neither. > > > I feel strongly that we have to warn when bypassing the charge limit > > during the corner case because it can lead to unexpected behavior and > > users should be aware of this fact. I am open to the wording or some > > optimizations. I would prefer the latter on top with a clear description > > how it helped in a particular case though. I would rather not over > > optimize now without any story to back it. > > I'm fine with the warning. I know enough to look at dmesg logs to take > an educates that the race occurred. We can refine it later if/when the > reports start rolling in. No change needed. OK. Thanks! -- Michal Hocko SUSE Labs