Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp848243ybj; Tue, 5 May 2020 08:29:21 -0700 (PDT) X-Google-Smtp-Source: APiQypIv12qxtFS2KhDcmUA1QN6uDSVEVnjrYoRciohhcImsSh+ZEimY6oXLYdlxcKCIFz9XR/Ac X-Received: by 2002:a17:906:130e:: with SMTP id w14mr3221937ejb.155.1588692560856; Tue, 05 May 2020 08:29:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588692560; cv=none; d=google.com; s=arc-20160816; b=ls+ufuWm87cJalDKH8qNmoz0tYXcoEJfOj9N+AZ3nx5FOJDtqM9C3w0MnrHTaJ6HtC sjyOA9C/HLVo/gi2RJsBMSDC+cbK2k9G0C5EJDq6KL6wcOUn7J64dyHaCIY7aE24aWcG 5HFUPQpp9TWubCVy24sOm6HCEZGZvwtggSwiRqR5WO095j5Kn9HfsC+8hgKCO9CDjENC tpQe44QPTwiRZWF3izRji1g6NgPUnnuOlv2ENFGp9oyNFeCNNm9R9dkRYnR9piUN3vgk ycj7K/iasnGMutq2xmrarxWDy7hD+Tlcu0XmEkx83YGVj+CMUFRfHcWCA1TJ0NIJrU3D 2SmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=r/em/r1WAWdIxfLddFgVdK8/WA54vnvCFmZ5eTaHEGI=; b=jxpf4MNrbTEv3x/i4TY3mk7jDgqlbMyxG8A5z+CnP0JdEF4t3djWNZV2GC9uiTHRTz fz7m1mzEZZ/R27ABvkY9QBO5i+7RcgGOD2OlUqrxn/5A2mbnarm3atU2UbYA9X/pHIEX GBab5G4bAuce8mE/QT+sFUSHGkk94ecsUXk+lCjoR5s4OOwUpS8U9lY2UZtyelgTO0pg 4RlJEF7+gvhJ9ruZlc4qPCdVgZuBeNTpG9VLPOTCqA6DzbW63TvfprP5qEe52mqcs+Qa qkMuntHmzZFEF217qVg1jaoJ9FTX3Fv4nhW8tFsHzWARIr8lb/EF8AKYsDaJmlMcWgLA xfbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=uuzwPXhv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d17si1263124ejh.334.2020.05.05.08.28.57; Tue, 05 May 2020 08:29:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=uuzwPXhv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730021AbgEEP13 (ORCPT + 99 others); Tue, 5 May 2020 11:27:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60364 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1729403AbgEEP12 (ORCPT ); Tue, 5 May 2020 11:27:28 -0400 Received: from mail-qk1-x742.google.com (mail-qk1-x742.google.com [IPv6:2607:f8b0:4864:20::742]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 16AA2C061A10 for ; Tue, 5 May 2020 08:27:28 -0700 (PDT) Received: by mail-qk1-x742.google.com with SMTP id b6so2639261qkh.11 for ; Tue, 05 May 2020 08:27:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=r/em/r1WAWdIxfLddFgVdK8/WA54vnvCFmZ5eTaHEGI=; b=uuzwPXhvPztMz4zHd3EPswjaU7UzyVLgP82njzHGSMhiwR7satUNP/H9oFmb2zmBl5 roz08OHw6yDtf5Pytm0tv38O7lGL7Qd2QRHmJugb2TZycLQSah4WdqOk5gw599MivkHp RCDAR0ljKALkXIj6099CztWvxNRAyHv7a4ZolmsRwjb61C2Mof0IbYRyxWnMY32Qegcy BR6BEgzPa5/wJZzHwWRMvsex+cJAIMBplmh6n+c4XfhSUZwmp7EOJy4Mv3YOLsK3mTcs TXxNZEIogoS1EOphfSvEWmBrZbpPpUGSnPwBXhI/r5GnunV7OX6rnQXGolj581CtOEqP iECg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=r/em/r1WAWdIxfLddFgVdK8/WA54vnvCFmZ5eTaHEGI=; b=t9qj0aSUSubR1uUqxVyDxFKxYvs6ts9BEkHQ4+/ZZAmB4BZjRfUn2VklWGKhLOhh/n P2Fb7vk7na29JvFRVizoNBaOb6v7O5ma8LVU1+UKHgWSvjNpeMR8SgSecuI0DaoBksfJ QsKb18DSgj5eLcuiUIm0b3oAdDL5SnEHb1z+amDXfvYY80VhBt9n1iiqhXEpDqER++rO YKRkO5tAtGFANA1okOE5/jfBg1mslfLe8oQWudxAt6TXqzLMv+Na8rN143Bz6lGwPyZg P5HHZpz2cY92j4IQSFdLRYJEGZg6YEtWc3ivVsBM9XILbx8cOAEECC5O91zQf0ylKn7H Pyvw== X-Gm-Message-State: AGi0PuYBb7bt2JC9+3ykS+g1Z6pcnAS+HNOTC6EoIrZqmKXk9B9G1O5/ S7yr3d5JS2hQQ2ERNnB5LMXK9Q== X-Received: by 2002:a05:620a:13f2:: with SMTP id h18mr3952397qkl.37.1588692447220; Tue, 05 May 2020 08:27:27 -0700 (PDT) Received: from localhost (70.44.39.90.res-cmts.bus.ptd.net. [70.44.39.90]) by smtp.gmail.com with ESMTPSA id a139sm2050850qkg.107.2020.05.05.08.27.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 May 2020 08:27:26 -0700 (PDT) Date: Tue, 5 May 2020 11:27:12 -0400 From: Johannes Weiner To: Shakeel Butt Cc: Michal Hocko , Roman Gushchin , Greg Thelen , Andrew Morton , Linux MM , Cgroups , LKML Subject: Re: [PATCH] memcg: oom: ignore oom warnings from memory.max Message-ID: <20200505152712.GB58018@cmpxchg.org> References: <20200430182712.237526-1-shakeelb@google.com> <20200504065600.GA22838@dhcp22.suse.cz> <20200504141136.GR22838@dhcp22.suse.cz> <20200504150052.GT22838@dhcp22.suse.cz> <20200504160613.GU22838@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 04, 2020 at 12:23:51PM -0700, Shakeel Butt wrote: > On Mon, May 4, 2020 at 9:06 AM Michal Hocko wrote: > > I really hate to repeat myself but this is no different from a regular > > oom situation. > > Conceptually yes there is no difference but there is no *divine > restriction* to not make a difference if there is a real world > use-case which would benefit from it. I would wholeheartedly agree with this in general. However, we're talking about the very semantics that set memory.max apart from memory.high: triggering OOM kills to enforce the limit. > > when the kernel cannot act and mentions that along with the > > oom report so that whoever consumes that information can debug or act on > > that fact. > > > > Silencing the oom report is simply removing a potentially useful > > aid to debug further a potential problem. > > *Potentially* useful for debugging versus actually beneficial for > "sweep before tear down" use-case. Also I am not saying to make "no > dumps for memory.max when no eligible tasks" a set in stone rule. We > can always reevaluate when such information will actually be useful. > > Johannes/Andrew, what's your opinion? I still think that if you want to sweep without triggering OOMs, memory.high has the matching semantics. As you pointed out, it doesn't work well for foreign charges, but that is more of a limitation in the implementation than in the semantics: /* * If the hierarchy is above the normal consumption range, schedule * reclaim on returning to userland. We can perform reclaim here * if __GFP_RECLAIM but let's always punt for simplicity and so that * GFP_KERNEL can consistently be used during reclaim. @memcg is * not recorded as it most likely matches current's and won't * change in the meantime. As high limit is checked again before * reclaim, the cost of mismatch is negligible. */ Wouldn't it be more useful to fix that instead? It shouldn't be much of a code change to do sync reclaim in try_charge(). Then you could express all things that you asked for without changing any user-visible semantics: sweep an empty cgroup as well as possible, do not oom on remaining charges that continue to be used by processes outside the cgroup, do trigger oom on new foreign charges appearing due to a misconfiguration. echo 0 > memory.high cat memory.current > memory.max Would this work for you?