From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DFA08C433EC for ; Mon, 20 Jul 2020 12:19:53 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 9D6E622B4D for ; Mon, 20 Jul 2020 12:19:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="SM6qhJ2q" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9D6E622B4D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 16FFD6B0002; Mon, 20 Jul 2020 08:19:53 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 121A96B0005; Mon, 20 Jul 2020 08:19:53 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 037266B0006; Mon, 20 Jul 2020 08:19:52 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0048.hostedemail.com [216.40.44.48]) by kanga.kvack.org (Postfix) with ESMTP id E295E6B0002 for ; Mon, 20 Jul 2020 08:19:52 -0400 (EDT) Received: from smtpin03.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 5DF8029B82D0 for ; Mon, 20 Jul 2020 12:19:52 +0000 (UTC) X-FDA: 77058360624.03.event64_410dbb326f24 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin03.hostedemail.com (Postfix) with ESMTP id 270F91E5F7D for ; Mon, 20 Jul 2020 12:19:52 +0000 (UTC) X-HE-Tag: event64_410dbb326f24 X-Filterd-Recvd-Size: 4664 Received: from mail-il1-f193.google.com (mail-il1-f193.google.com [209.85.166.193]) by imf42.hostedemail.com (Postfix) with ESMTP for ; Mon, 20 Jul 2020 12:19:51 +0000 (UTC) Received: by mail-il1-f193.google.com with SMTP id t4so13069082iln.1 for ; Mon, 20 Jul 2020 05:19:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=f/Ei8dW5WezytVSxMAAZJNxbcxZGh5bIHmLGR/kaph0=; b=SM6qhJ2qtaqO7XXWr/jgVW9te/b6ng+EkEylH4gMDRl0M0K4KZBTqEw8UhL2p3k8V/ FHAawCoM2yRCPOykg5rRUJMUIBhdl7LJ7sveSu/bABMX0lscBNAiewRqgNQbl+uuC61G Q9O57ef6BMQqyA/x7x2bmyE1AKMbbbjtzQ45OtA9cb9r9ghfInUAS6IPpSMw72yBz4rr u0McPIxpvEe6Jn9+robaRBDyHhOVw3pjtmEsXDI7hB0bMV/uxvexC9ZpjopzzkziYPxX UQZRlJBO09sS5FB27KAL1wbH9iszKFRAIWLOl6BGl1W8Eq31Xt8NuM/BzT6Lrww4UyQr wgKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=f/Ei8dW5WezytVSxMAAZJNxbcxZGh5bIHmLGR/kaph0=; b=p5U1olTFUQ1TeNfEGfMdpbTroW+n67j4gdgVOlaopN3TVG2IpdOxzGAeJl1Tk2DTWj TcIpNnfVg9A9OIeB9LNDgYIu9FlhvuZ8tetYoanjpqm5Yv5QoTguVTn8BCdfT1E8iKoL u2QHJDQ6/C2pUfNDatLBurn2jC3eYVT9GrFOB/ixltuoS6YbZhV57NX2YWNKnbMlUVIY 4SI2lqHn/bj+5STCXeIrqVA4FfBtJ0gSftg9cKgzfzMKq18CDQAboErFa3AXc07qAy8g z5Jpm8c365/BpCAJO8a/b/RiPvU6Bu9eSNdsE/ptcmrvXHzOXxiY84ewHO+JRUc0GEpY 552Q== X-Gm-Message-State: AOAM531BWLF22ZlJZe+Efxc7ztH/rQL4oGuXFVbtom8/vWaXSoC2agz9 7whm0HJfOAqATf5spq7ebQgLgAq+uP5UM8nkPdM= X-Google-Smtp-Source: ABdhPJy60haOTsNS4CjeGIuTwcjAgMibYyt77kAg6aLa1TXoY98arK6kW01wCIfnJgnXm5TfbdybaGnULMKNiazVIs8= X-Received: by 2002:a92:c205:: with SMTP id j5mr13757467ilo.137.1595247590952; Mon, 20 Jul 2020 05:19:50 -0700 (PDT) MIME-Version: 1.0 References: <1595166795-27587-1-git-send-email-laoar.shao@gmail.com> <20200720071607.GA18535@dhcp22.suse.cz> <253332d9-9f8c-d472-0bf4-388b29ecfb96@i-love.sakura.ne.jp> In-Reply-To: <253332d9-9f8c-d472-0bf4-388b29ecfb96@i-love.sakura.ne.jp> From: Yafang Shao Date: Mon, 20 Jul 2020 20:19:14 +0800 Message-ID: Subject: Re: [PATCH] mm, oom: show process exiting information in __oom_kill_process() To: Tetsuo Handa Cc: Michal Hocko , David Rientjes , Andrew Morton , Linux MM Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 270F91E5F7D X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam04 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Mon, Jul 20, 2020 at 7:06 PM Tetsuo Handa wrote: > > On 2020/07/20 19:36, Yafang Shao wrote: > > On Mon, Jul 20, 2020 at 3:16 PM Michal Hocko wrote: > >> I do agree that a silent bail out is not the best thing to do. The above > >> message would be more useful if it also explained what the oom killer > >> does (or does not): > >> > >> "OOM victim %d (%s) is already exiting. Skip killing the task\n" > >> > > > > Sure. > > This path is rarely hit because find_lock_task_mm() in oom_badness() from > select_bad_process() in the next round of OOM killer will skip this task. > > Since we don't wake up the OOM reaper when hitting this path, unless __mmput() > for this task itself immediately reclaims memory and updates the statistics > counter, we just get two chunks of dump_header() messages and one OOM victim. > Could you pls. explain more specifically why we will get two chunks of dump_header()? My understanding is the free_mm() happens between select_bad_process() and __oom_kill_process() as bellow, P1 Victim select_bad_process() oom_badness() p = find_lock_task_mm() # p isn't NULL __mmput() free_mm() dump_header() # dump once __oom_kill_process() p = find_lock_task_mm(victim); # p is NULL now So where is another dump_header() ? > Current synchronous printk() gives __mmput() some time for reclaiming memory > and updating the statistics counter. But when printk() becomes asynchronous, > there might be quite small time. People might wonder "why killed message > follows immediately after skipped killing message"... Wouldn't the skip > message confuse people? -- Thanks Yafang