Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp3390443imm; Mon, 6 Aug 2018 04:03:56 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeA0qQg4CWazW+s8qm1yD0GMubbkWDj0glouYdtxYrFme7T9IqClOAHhE/yK8qTGVa0Y2Ua X-Received: by 2002:aa7:8713:: with SMTP id b19-v6mr16543546pfo.151.1533553436028; Mon, 06 Aug 2018 04:03:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533553435; cv=none; d=google.com; s=arc-20160816; b=E76R+qCgzFldherAaCCpwrAQgSbT/kUl3oILNPUS/nAsaky5eUfnETIQCYLaXx/ssF 7g4IjPbycx8V0yUfQiwN7jAEXLZphigmiDjkXa/yBVv4x2AK+7fjCX0QSXs3I3hCn5pc 492pxhJEBQJZODranUtnAt21UmUMImZynvOK44ugGwOrzAZ884GE9E19L0zbj842Mo/A jWV9UwGB3KXZgkKdW5D0D91t495UGXpuChLfd4DgzOtEfM6yD7vnWg21+FCcjEj9Gflm jyLg+3zGGDD+df8cCTt2+4D8YaAGhskkKoOL0kNEEr8P2aU2buHE/1d9I9YTWyTr1Qtx CTUw== 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=Y571Wv72Qy2Yq2wf6JXYikAw17fHK9GwkgodQgSny64=; b=O3/yoHIV8GmBiCPl7eAmKGmLTFw4c8YHnt+9qM4cC8mzcTGSVP31b96nP6U72NimPM cnJBCFJSklFU8h2pamV9Z/YmBJg8uLWDzW7eu33Yyzc5BAsgzeyi8utogtmkmgriD/3G PZDeNqTL4E3EbnuqHRgTTyzHCFG20lLPSdgQ97pNcqZVAbPe6YLw45HxQtGgZkN7UZMK O3NOf85ecRagTyUMxk6+toU7GPa9q2gKzRLl+Zc9cSI77AjKDnBK3mXVIhiXwAHsGCaY wwz+ecrQ9TGIvQEm3j6XX27wE+aXvceDtxpYdQbvYpvPQfYqm4T8963mGlgQtLocQSb7 Os8A== 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 k140-v6si5976645pfd.122.2018.08.06.04.03.41; Mon, 06 Aug 2018 04:03:55 -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 S1729914AbeHFNLA (ORCPT + 99 others); Mon, 6 Aug 2018 09:11:00 -0400 Received: from mx2.suse.de ([195.135.220.15]:48502 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727004AbeHFNLA (ORCPT ); Mon, 6 Aug 2018 09:11: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 82AA8AE5D; Mon, 6 Aug 2018 11:02:26 +0000 (UTC) Date: Mon, 6 Aug 2018 13:02:24 +0200 From: Michal Hocko To: Dmitry Vyukov Cc: syzbot , cgroups@vger.kernel.org, Johannes Weiner , LKML , Linux-MM , syzkaller-bugs , Vladimir Davydov , Dmitry Torokhov Subject: Re: WARNING in try_charge Message-ID: <20180806110224.GI19540@dhcp22.suse.cz> References: <0000000000005e979605729c1564@google.com> <20180806091552.GE19540@dhcp22.suse.cz> <20180806094827.GH19540@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 Mon 06-08-18 12:34:30, Dmitry Vyukov wrote: > On Mon, Aug 6, 2018 at 11:48 AM, Michal Hocko wrote: > > On Mon 06-08-18 11:30:37, Dmitry Vyukov wrote: > >> On Mon, Aug 6, 2018 at 11:15 AM, Michal Hocko wrote: > > [...] > >> > More interesting stuff is higher in the kernel log > >> > : [ 366.435015] oom-kill:constraint=CONSTRAINT_MEMCG,nodemask=(null),cpuset=/,mems_allowed=0,oom_memcg=/ile0,task_memcg=/ile0,task=syz-executor3,pid=23766,uid=0 > >> > : [ 366.449416] memory: usage 112kB, limit 0kB, failcnt 1605 > >> > > >> > Are you sure you want to have hard limit set to 0? > >> > >> syzkaller really does not mind to have it. > > > > So what do you use it for? What do you actually test by this setting? > > syzkaller is kernel fuzzer, it finds kernel bugs by doing whatever is > doable from user-space. Some of that may not make sense, but it does > not matter because kernel should still stand still. I am not questioning that. What I am saying is that the configuration doesn't make much sense and the kernel warns about it. > > [...] > >> > diff --git a/mm/memcontrol.c b/mm/memcontrol.c > >> > index 4603ad75c9a9..852cd3dbdcd9 100644 > >> > --- a/mm/memcontrol.c > >> > +++ b/mm/memcontrol.c > >> > @@ -1388,6 +1388,8 @@ static bool mem_cgroup_out_of_memory(struct mem_cgroup *memcg, gfp_t gfp_mask, > >> > bool ret; > >> > > >> > mutex_lock(&oom_lock); > >> > + pr_info("task=%s pid=%d invoked memcg oom killer. oom_victim=%d\n", > >> > + current->comm, current->pid, tsk_is_oom_victim(current)); > >> > ret = out_of_memory(&oc); > >> > mutex_unlock(&oom_lock); > >> > return ret; > >> > > >> > Anyway your memcg setup is indeed misconfigured. Memcg with 0 hard limit > >> > and basically no memory charged by existing tasks is not going to fly > >> > and the warning is exactly to call that out. > >> > >> > >> Please-please-please do not mix kernel bugs and notices to user into > >> the same bucket: > > > > Well, WARN_ON used to be a standard way to make user aware of a > > misbehavior. In this case it warns about a pottential runaway when memcg > > is misconfigured. I do not insist on using WARN_ON here of course. If > > there is a general agreement that such a condition is better handled by > > pr_err then I am fine with it. Users tend to be more sensitive on > > WARN_ONs though. > > The docs change was acked by Greg, and Andrew took it into mm, Linus > was CCed too. It missed the release because I guess it's comments only > change, but otherwise it should reach upstream tree on the next merge > window. > > WARN is _not_ a common way to notify users today. syzbot reports _all_ > WARN occurrences and you can see there are not many of them now > (probably 1 another now, +dtor for that one): > https://syzkaller.appspot.com#upstream > There is probably some long tail that we need to fix. We really do > want systematic testing capability. You do not want every of 2 billion > linux users to come to you with this kernel splat, just so that you > can explain to them that it's some programs of their machines doing > something wrong, right? [This is an orthogonal discussion I believe] How does it differ from pr_err though? > WARN is really a bad way to inform a user about something. Consider a > non-kernel developer, perhaps even non-programmer. What they see is > "WARNING: CPU: 1 PID: 23767 at mm/memcontrol.c:1710 > try_charge+0x734/0x1680" followed by some obscure things and hex > numbers. File:line reference is pointless, they don't what what/where > it is. Well, you get a precise location where the problem happens and the backtrace to see how it happened. This is much more information than, pr_err without dump_stack. > This one is slightly better because it prints "Memory cgroup > charge failed because of no reclaimable memory! This looks like a > misconfiguration or a kernel bug." before the warning. But still it > says "or a kernel bug", which means that they will come to you. Yeah, and that was the purpose of the thing. > A much > friendlier for user way to say this would be print a message at the > point of misconfiguration saying what exactly is wrong, e.g. "pid $PID > misconfigures cgroup /cgroup/path with mem.limit=0" without a stack > trace (does not give any useful info for user). And return EINVAL if > it can't fly at all? And then leave the "or a kernel bug" part for the > WARNING each occurrence of which we do want to be reported to kernel > developers. But this is not applicable here. Your misconfiguration is quite obvious because you simply set the hard limit to 0. This is not the only situation when this can happen. There is no clear point to tell, you are doing this wrong. If it was we would do it at that point obviously. If you have a strong reason to believe that this is an abuse of WARN I am all happy to change that. But I haven't heard any yet, to be honest. -- Michal Hocko SUSE Labs