Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1595277imm; Sat, 4 Aug 2018 06:46:56 -0700 (PDT) X-Google-Smtp-Source: AAOMgpc6QxDcdc7OS7miBZ+r5OCRbJtIeSWIKzRAPGiBLDFucpw8HDflgC3M3ojXaJttixWe+kOh X-Received: by 2002:a62:cf82:: with SMTP id b124-v6mr9227960pfg.142.1533390416328; Sat, 04 Aug 2018 06:46:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533390416; cv=none; d=google.com; s=arc-20160816; b=RBZQQTahmdzbN0pnAwua6y5G30peEHLsmdszQTJKczpSPsM2jJ8fGTgSz5j1CCu7Ke vick0A5Zr6TXWlli02kzVFpv58pZJL9asttAMDEDFMrRXaNb5u8pTatAdULVBWIeAEXW sjn7hDXt3w8zHT3+JS7TD/+YfI3x1MzCRnEq0zspyQX1I9igGci2IA+y+A789XkZDZGa vJqX9cilejZlAOQ6uADp9/CTVZB0qv+0p9o57l2yX7HrsaYtJ/i7PCbapHwb+wBa03g3 wSqI7zmLxOqGAHoZKTTKzogzStxCcGBLEITAzF8IlFJt2Wojqk4Pia0VLkY6Z3t1wsG1 0SKQ== 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:cc:references:to:subject:arc-authentication-results; bh=gFnNqYF8RSjaovTjh7LzbD4tfVwbD3wsR/XOeExXz1E=; b=y2Wg0yubJxNp0VliM+qHtvRBmnvoAS0eScaiD1l9hwPVRN3S+Y8n0Ilopvsj0UOAar TjCjzJN9Wv6pQedhT875mDk4HFEAxxpiBuzxNeMNkavvyrBu0qXqNjVFePaQH8LnWdzq TFq5QQOBQ32ZSAcRIIGUuUNIZHV38BltfOmr4awNJddGv5xjcHRgxvfbZklqjwTXSfyx dIU2w3Y8PqUOvFuAOSavhErcFM7cp4LzI+F9WzINd/qwjoRN/LG1JNhkVFrYbqf+J/T7 dhnfFFYEuDeWl0WtP+NtpPLvwTMqg9ILr8ajGjQoc78bT6DwK20FniNFrIxOjZQhiBpA XEag== 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 c9-v6si7338619pgi.493.2018.08.04.06.46.30; Sat, 04 Aug 2018 06:46:56 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728205AbeHDPpw (ORCPT + 99 others); Sat, 4 Aug 2018 11:45:52 -0400 Received: from www262.sakura.ne.jp ([202.181.97.72]:22607 "EHLO www262.sakura.ne.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726696AbeHDPpw (ORCPT ); Sat, 4 Aug 2018 11:45:52 -0400 Received: from fsav304.sakura.ne.jp (fsav304.sakura.ne.jp [153.120.85.135]) by www262.sakura.ne.jp (8.15.2/8.15.2) with ESMTP id w74Dj4J5011061; Sat, 4 Aug 2018 22:45:04 +0900 (JST) (envelope-from penguin-kernel@I-love.SAKURA.ne.jp) Received: from www262.sakura.ne.jp (202.181.97.72) by fsav304.sakura.ne.jp (F-Secure/fsigk_smtp/530/fsav304.sakura.ne.jp); Sat, 04 Aug 2018 22:45:04 +0900 (JST) X-Virus-Status: clean(F-Secure/fsigk_smtp/530/fsav304.sakura.ne.jp) Received: from [192.168.1.8] (softbank126074194044.bbtec.net [126.74.194.44]) (authenticated bits=0) by www262.sakura.ne.jp (8.15.2/8.15.2) with ESMTPSA id w74Dj3bA011057 (version=TLSv1.2 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 4 Aug 2018 22:45:04 +0900 (JST) (envelope-from penguin-kernel@I-love.SAKURA.ne.jp) Subject: Re: WARNING in try_charge To: mhocko@kernel.org, David Rientjes References: <0000000000005e979605729c1564@google.com> Cc: syzbot , cgroups@vger.kernel.org, hannes@cmpxchg.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, syzkaller-bugs@googlegroups.com, vdavydov.dev@gmail.com From: Tetsuo Handa Message-ID: <4660f164-b3e3-28a0-9898-718c5fa6b84d@I-love.SAKURA.ne.jp> Date: Sat, 4 Aug 2018 22:45:03 +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: <0000000000005e979605729c1564@google.com> 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 syzbot is hitting WARN(1) because of mem_cgroup_out_of_memory() == false. At first I suspected that syzbot is hitting static bool oom_kill_memcg_victim(struct oom_control *oc) { if (oc->chosen_memcg == NULL || oc->chosen_memcg == INFLIGHT_VICTIM) return oc->chosen_memcg; case because /* We have one or more terminating processes at this point. */ oc->chosen_task = INFLIGHT_VICTIM; is not called. But since that patch was dropped from next-20180803, syzbot seems to be hitting a different race condition ( https://syzkaller.appspot.com/text?tag=CrashLog&x=12071654400000 ). Therefore, next culprit I suspect is mm, oom: remove oom_lock from oom_reaper oom_reaper used to rely on the oom_lock since e2fe14564d33 ("oom_reaper: close race with exiting task"). We do not really need the lock anymore though. 212925802454 ("mm: oom: let oom_reap_task and exit_mmap run concurrently") has removed serialization with the exit path based on the mm reference count and so we do not really rely on the oom_lock anymore. Tetsuo was arguing that at least MMF_OOM_SKIP should be set under the lock to prevent from races when the page allocator didn't manage to get the freed (reaped) memory in __alloc_pages_may_oom but it sees the flag later on and move on to another victim. Although this is possible in principle let's wait for it to actually happen in real life before we make the locking more complex again. Therefore remove the oom_lock for oom_reaper paths (both exit_mmap and oom_reap_task_mm). The reaper serializes with exit_mmap by mmap_sem + MMF_OOM_SKIP flag. There is no synchronization with out_of_memory path now. which is in next-20180803, and my "mm, oom: Fix unnecessary killing of additional processes." ( https://marc.info/?i=1533389386-3501-4-git-send-email-penguin-kernel@I-love.SAKURA.ne.jp ) could mitigate it. Michal and David, please respond.