Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp3381291imm; Mon, 6 Aug 2018 03:53:49 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdi+OaRloS7sPkolaJdFLsd9okgleH5xvlyZG8fGGXd895CeEe01ocoK1vR3Xa4C5QthkvV X-Received: by 2002:a63:f414:: with SMTP id g20-v6mr14058187pgi.407.1533552829917; Mon, 06 Aug 2018 03:53:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533552829; cv=none; d=google.com; s=arc-20160816; b=x6kOktu7ao3aXVEFxUTDlG9Dw8kn+/xu302Qu1ERhFOEa+V7otYPZ/Qm5arkQVT7Iz z9dndpuejD2EOj9L9D9x0CrbAU/+BmEWNRcS/oHPxe50/FGD9zNdnpH1jOR/KEqWdiyX 3ibXrT3LFfB1phftJhqv4xE7s1lXWrTttrx0tAVKWNoWzzPbv6YafFdGhJB+7xuOvBHI MPRq0J0YK09/D8q9VjDBH/nasoL7oZZFor/DbkCpgwiilUnthjPI8x8cUcJtjqR/XKVr VoCvrlIZNXWylkpj5N0D10aNInQsBIrwA2zHWj+DwSkfJpXcUlbeO6eQ3NYOLFuyF4vS 13kQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=3YXuO62zqnigkAN0aa5Es4B/dz6ofYWKyyPaB8qwyBg=; b=DxHQcK4Zi0O3b+J97lU7uWpEmXZ79JEgH4ExN5UjX5a7oj40NWW+9lHoZpcmZuJVs+ w0T5u/NW9DODPxHzAM94HsuFpTiSBwnmhLQah9GiLxo5e0A3iTDWb3LVXZU0jncGbm8j 8tL80ihMJ4EHstzYFWPda1E/MMekJipGrbQsd0FtVfkQKfa2wVKQEV2cr9Cv5kKU7buA PwIAU6Ts3CX5ZUDbSieS8DrUTpmnBsMxH98LWreHTMPzkCJDbg0LcATG80vVrWS+WAP2 7vKL1omgmVTh/4mw4gGPRM0TTG8eOstPCTW2X7iXH8aAtNZkBRnWN8hqa8Um4GwQ8fRo b1lA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=p9++obN7; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com 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.03.53.34; Mon, 06 Aug 2018 03:53:49 -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; dkim=pass header.i=@google.com header.s=20161025 header.b=p9++obN7; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729324AbeHFMr6 (ORCPT + 99 others); Mon, 6 Aug 2018 08:47:58 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:41762 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727561AbeHFMr6 (ORCPT ); Mon, 6 Aug 2018 08:47:58 -0400 Received: by mail-pf1-f196.google.com with SMTP id y10-v6so6676411pfn.8 for ; Mon, 06 Aug 2018 03:39:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=3YXuO62zqnigkAN0aa5Es4B/dz6ofYWKyyPaB8qwyBg=; b=p9++obN7bsuMznBuY9mt+9yKa53K0fh+f6X2nNEhsxuJDbj6Vlz3z0cgSvaqKAbpZu Dz3RUBTvI/EGw052s6VJtCIgIX8PbGY0PnxrH4BzaruFXW+eLzT9r13Du1ALrJUiJe8q utYw9DCvPX2EGGCppcazaAOTNJ/QFrA+m3D/LvGhy1FI2ybImn5V6VvdvqQ1G7GbMBqp BxK3kviY8Avh7FSs8HOWSGd4/S6Twv3O2PsvH/5mcpXfRQ7GnAc4DUzwYvJB9b9Hyu/p Gs00JnDoSQlMaAzjyg5A63glE5wXypda2D35Xq2Yjpjqt1N9sFLj6gL4j7u8r33nT9QG hEeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=3YXuO62zqnigkAN0aa5Es4B/dz6ofYWKyyPaB8qwyBg=; b=o0v00nVsZp955yevPskffMgT+cLp4eBFN6LMgEKh+7wiOGXCpN5Sw5L4wvoRoivE6P Nh8syuxyVPZlI3UxeeRtxZ+965i9qoz1yvx/hfdp/kS2xfb+gimQDq60+JKPCGoNydTG Q4cWEc6xNN+t+rcwSAVznaT3A1o1k+ndcIvOv5elqAkeEE+Zi9qW3mH+FB74apmGvLTk I+qfTB9tcXzV6guNkEkwyn/8BWtH7xlLbhsza3TTEj7K+fockoDVqFm9/l8tT/9GqFMj BnSMk9iQNM7v44ywvO2rH3Flc2rnKCH7QMW4qHYqF6jZStlEO+rAI45TZln552vnR7nG NYBQ== X-Gm-Message-State: AOUpUlHjrbghr6Z42GCezN0wnkOJYYqSJ/V9NimYL3FeyFaOVelpSp6E Cb6nHHpN3tu/KV2xGfC6PSjp1bxJFgK3xAcKBmNlqA== X-Received: by 2002:a63:1f20:: with SMTP id f32-v6mr13528736pgf.84.1533551970972; Mon, 06 Aug 2018 03:39:30 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a17:90a:ac14:0:0:0:0 with HTTP; Mon, 6 Aug 2018 03:39:09 -0700 (PDT) In-Reply-To: <20180806094827.GH19540@dhcp22.suse.cz> References: <0000000000005e979605729c1564@google.com> <20180806091552.GE19540@dhcp22.suse.cz> <20180806094827.GH19540@dhcp22.suse.cz> From: Dmitry Vyukov Date: Mon, 6 Aug 2018 12:39:09 +0200 Message-ID: Subject: Re: WARNING in try_charge To: Michal Hocko Cc: syzbot , cgroups@vger.kernel.org, Johannes Weiner , LKML , Linux-MM , syzkaller-bugs , Vladimir Davydov Content-Type: multipart/mixed; boundary="0000000000007a019c0572c1e4c7" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --0000000000007a019c0572c1e4c7 Content-Type: text/plain; charset="UTF-8" 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? > > [...] >> > 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. > > Btw. running with the above diff on top might help us to ideantify > whether this is a pre-mature warning or a valid one. Still useful to > find out. The bug report has a reproducer, so you can run it with the patch. Or ask syzbot to test your patch: https://github.com/google/syzkaller/blob/master/docs/syzbot.md#testing-patches Which basically boils down to saying: #syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master Note that a text patch without a base tree/commit can be useless, I used torvalds/linux.git but I don't know if it will apply there or not. Let's see. --0000000000007a019c0572c1e4c7 Content-Type: text/x-patch; charset="US-ASCII"; name="cgroup.patch" Content-Disposition: attachment; filename="cgroup.patch" Content-Transfer-Encoding: base64 X-Attachment-Id: f_jki54m7q0 ZGlmZiAtLWdpdCBhL21tL21lbWNvbnRyb2wuYyBiL21tL21lbWNvbnRyb2wuYwppbmRleCA0NjAz YWQ3NWM5YTkuLjg1MmNkM2RiZGNkOSAxMDA2NDQKLS0tIGEvbW0vbWVtY29udHJvbC5jCisrKyBi L21tL21lbWNvbnRyb2wuYwpAQCAtMTM4OCw2ICsxMzg4LDggQEAgc3RhdGljIGJvb2wgbWVtX2Nn cm91cF9vdXRfb2ZfbWVtb3J5KHN0cnVjdCBtZW1fY2dyb3VwICptZW1jZywgZ2ZwX3QgZ2ZwX21h c2ssCiAJYm9vbCByZXQ7CiAKIAltdXRleF9sb2NrKCZvb21fbG9jayk7CisJcHJfaW5mbygidGFz az0lcyBwaWQ9JWQgaW52b2tlZCBtZW1jZyBvb20ga2lsbGVyLiBvb21fdmljdGltPSVkXG4iLAor CQkJY3VycmVudC0+Y29tbSwgY3VycmVudC0+cGlkLCB0c2tfaXNfb29tX3ZpY3RpbShjdXJyZW50 KSk7CiAJcmV0ID0gb3V0X29mX21lbW9yeSgmb2MpOwogCW11dGV4X3VubG9jaygmb29tX2xvY2sp OwogCXJldHVybiByZXQ7Cgo= --0000000000007a019c0572c1e4c7--