Received: by 2002:ac0:aa62:0:0:0:0:0 with SMTP id w31-v6csp2041544ima; Mon, 22 Oct 2018 03:15:00 -0700 (PDT) X-Google-Smtp-Source: ACcGV62NHZnkJfNl3o9rz3bY11SUkUCzF7YGBG/YXCMkV/QbHnchNjSoSEqowq/QgKVzvRBOMiqK X-Received: by 2002:a17:902:a503:: with SMTP id s3-v6mr12987908plq.35.1540203300865; Mon, 22 Oct 2018 03:15:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540203300; cv=none; d=google.com; s=arc-20160816; b=MoVniKRqWKpvTv26ZkS561slnbvhZQojRzqfpEHH6kdV8ys3zJLiNirhsfYWxV1J9t dyZ23WHlpPgo58+dorZyk+HG76ZjxaJgs6XXmtWkA+aToN4wkB9loEg0jifti1GABkIR JT2wWI6cxxJ4434DpPB9LPvEkaTZEKwtSbz5z7EWbC+yuq2sBUwXgRkk2d3E8rnOZCV+ H6cD6bg1hKNxPH41KUJ4jiLr8dwqMWs+c2M9knYdm9aFzLsjx0IpzLxXvyDONgdXVk4S OaVRJmX3pQH3toqjmIez8JH25LGeKKi6zJ3zpPatKLbEMd9QMz3JoQZ9Ho0yS91Ch8T5 Gx/w== 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:references:cc:to:subject; bh=N3WCuS7Hwfsr1SmToIvIdyhX3ApE1BcYuWb9Z5+qgWQ=; b=URCN17tXl1XKC1ZwRi3RRt2cDKwlkSci1iUBeFjWsEUSVB2j+4frw2AtsS5QEQRAK2 kAMmZ8xqhbu0w0nDiGoJCsIIA2N0uCJbnUVriBRyVO2q07XMQrducFxb+tOXul66pdjH AP0JJ4IGJwrLq/cOhWeFC2YQGIb+4WjmBPwoWKimUSbi07dNUVV7js5GB/PDXqUf04lQ occS9VhTuP7MEO234HTx71ahsfR+vYLNwbpbC5YnqWgmHDPKqN76JeVR4U7orcke+A61 WDmmJRMIu5zGuUeOCm00JYglRpjsCzIAj/gYCy7C+IA3dwNiGqbLtuHh1vnCKNxMunrv 2Sug== 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 l3-v6si34227796pld.404.2018.10.22.03.14.45; Mon, 22 Oct 2018 03:15:00 -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 S1728372AbeJVSAb (ORCPT + 99 others); Mon, 22 Oct 2018 14:00:31 -0400 Received: from www262.sakura.ne.jp ([202.181.97.72]:60894 "EHLO www262.sakura.ne.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727519AbeJVSAb (ORCPT ); Mon, 22 Oct 2018 14:00:31 -0400 Received: from fsav405.sakura.ne.jp (fsav405.sakura.ne.jp [133.242.250.104]) by www262.sakura.ne.jp (8.15.2/8.15.2) with ESMTP id w9M9gW6W092522; Mon, 22 Oct 2018 18:42:32 +0900 (JST) (envelope-from penguin-kernel@i-love.sakura.ne.jp) Received: from www262.sakura.ne.jp (202.181.97.72) by fsav405.sakura.ne.jp (F-Secure/fsigk_smtp/530/fsav405.sakura.ne.jp); Mon, 22 Oct 2018 18:42:32 +0900 (JST) X-Virus-Status: clean(F-Secure/fsigk_smtp/530/fsav405.sakura.ne.jp) Received: from [192.168.1.8] (softbank060157066051.bbtec.net [60.157.66.51]) (authenticated bits=0) by www262.sakura.ne.jp (8.15.2/8.15.2) with ESMTPSA id w9M9gW2c092519 (version=TLSv1.2 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 22 Oct 2018 18:42:32 +0900 (JST) (envelope-from penguin-kernel@i-love.sakura.ne.jp) Subject: Re: [RFC PATCH 1/2] mm, oom: marks all killed tasks as oom victims To: Michal Hocko Cc: linux-mm@kvack.org, Johannes Weiner , David Rientjes , Andrew Morton , LKML References: <20181022071323.9550-1-mhocko@kernel.org> <20181022071323.9550-2-mhocko@kernel.org> <201810220758.w9M7wojE016890@www262.sakura.ne.jp> <20181022084842.GW18839@dhcp22.suse.cz> From: Tetsuo Handa Message-ID: Date: Mon, 22 Oct 2018 18:42:30 +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: <20181022084842.GW18839@dhcp22.suse.cz> 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 On 2018/10/22 17:48, Michal Hocko wrote: > On Mon 22-10-18 16:58:50, Tetsuo Handa wrote: >> Michal Hocko wrote: >>> --- a/mm/oom_kill.c >>> +++ b/mm/oom_kill.c >>> @@ -898,6 +898,7 @@ static void __oom_kill_process(struct task_struct *victim) >>> if (unlikely(p->flags & PF_KTHREAD)) >>> continue; >>> do_send_sig_info(SIGKILL, SEND_SIG_FORCED, p, PIDTYPE_TGID); >>> + mark_oom_victim(p); >>> } >>> rcu_read_unlock(); >>> >>> -- >> >> Wrong. Either > > You are right. The mm might go away between process_shares_mm and here. > While your find_lock_task_mm would be correct I believe we can do better > by using the existing mm that we already have. I will make it a separate > patch to clarity. Still wrong. p->mm == NULL means that we are too late to set TIF_MEMDIE on that thread. Passing non-NULL mm to mark_oom_victim() won't help. > @@ -898,7 +897,7 @@ static void __oom_kill_process(struct task_struct *victim) > if (unlikely(p->flags & PF_KTHREAD)) > continue; > do_send_sig_info(SIGKILL, SEND_SIG_FORCED, p, PIDTYPE_TGID); > - mark_oom_victim(p); > + mark_oom_victim(p, mm); > } > rcu_read_unlock(); >