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, URIBL_BLOCKED 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 01A50C433E1 for ; Tue, 14 Jul 2020 05:04:01 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 83C582193E for ; Tue, 14 Jul 2020 05:04:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="PceBEzCD" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 83C582193E 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 D33628D0002; Tue, 14 Jul 2020 01:04:00 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CE33A8D0001; Tue, 14 Jul 2020 01:04:00 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BF8C98D0002; Tue, 14 Jul 2020 01:04:00 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id AB62A8D0001 for ; Tue, 14 Jul 2020 01:04:00 -0400 (EDT) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 305A62C81 for ; Tue, 14 Jul 2020 05:04:00 +0000 (UTC) X-FDA: 77035489440.15.air93_4c0670526eee Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin15.hostedemail.com (Postfix) with ESMTP id 0D6BC1814B0C9 for ; Tue, 14 Jul 2020 05:04:00 +0000 (UTC) X-HE-Tag: air93_4c0670526eee X-Filterd-Recvd-Size: 4704 Received: from mail-il1-f195.google.com (mail-il1-f195.google.com [209.85.166.195]) by imf06.hostedemail.com (Postfix) with ESMTP for ; Tue, 14 Jul 2020 05:03:59 +0000 (UTC) Received: by mail-il1-f195.google.com with SMTP id h16so13152800ilj.11 for ; Mon, 13 Jul 2020 22:03:59 -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=xFYSoaVXkPGsyp2UPGlkSwthLLUDKyutZP7nZOqvAnQ=; b=PceBEzCDwl3wlC7HnCHOScwVHlA9vhIRHuWn6RJuU/hd08IXHHjlGe5Thp7727ewzv PovymyDc3DK1jKTUF6KwLNXLd8ORjnX0AsxzEQm1Fp8djl3f1VFxIfdRtqNaV12whdBe 3P9nsqI1f9mZsqtS0GvbNWqDIKXDB8YMd7qjCUZL0bcma5qPRrS/YsMjs4CVj/MaHzSq tjekEL1YzFIgEEzjc2GRmtANEW0CtAJa4zUDMwX+ufebzf92aB8UrEjyG8b4HLNZzieK oA9o4NPmApazsxJcaiekEZaGKiKcSCnTe5KNB5MoKP7SqZSreKUctfEDOhy2q2HhCUQC 01bQ== 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=xFYSoaVXkPGsyp2UPGlkSwthLLUDKyutZP7nZOqvAnQ=; b=YiWxy07Hf8/syPfGGeudct+Gpp+1RHYFdqRQE/+5QV8Fqj+Uzdw1hTYnjxORTpmacu XbzLneJXSqMx3MILhuI3mC2BFJm3axhvB0YsRjyWcHmQwh0t8MbyNN7CAWbu6s5aW1U8 cCc2cdDWotNYmlMJJaBNPTn1czJhxmSs/nSnPni0BPnqMt5JDtaVi4HlOKztPKMNlfbg HC69GCAyOuxRCl+8q6riP8rIfC208IPWnj6XL0EszOIbGoSTpzh1oO3pcJ2NRRJxCmes 6fToxZsa6ZjX8Lys0XmHCozW5J9aFRrnrPWHjNY9hg6arz7Ed7Kp5GKto9kpMG8KCC9x DcBQ== X-Gm-Message-State: AOAM530iI3NXanu0vM4PyEvhuIeo3XvlnTvlbPBaHqkB3I/KT9IwQPO1 vJOCOUCvX5opyAzpPicdgtlTQlff34JNh/qqkSc= X-Google-Smtp-Source: ABdhPJx8E45PNeMmNz9Dge/JtXRJiJCGhqmJmdCdZrnkZHUhPuS5ohoZlEEVpykLwzCpG7JlRmXLpycWLJL0gQpN1OQ= X-Received: by 2002:a92:c205:: with SMTP id j5mr3215521ilo.137.1594703039087; Mon, 13 Jul 2020 22:03:59 -0700 (PDT) MIME-Version: 1.0 References: <1594437481-11144-1-git-send-email-laoar.shao@gmail.com> <06806cf0-a122-e002-191f-348298358882@i-love.sakura.ne.jp> <61feb0d9-d443-c9b8-7058-e9597af405c5@i-love.sakura.ne.jp> <9b9c8510-1a1d-86b0-59ce-29992a53d52c@i-love.sakura.ne.jp> In-Reply-To: <9b9c8510-1a1d-86b0-59ce-29992a53d52c@i-love.sakura.ne.jp> From: Yafang Shao Date: Tue, 14 Jul 2020 13:03:23 +0800 Message-ID: Subject: Re: [PATCH] mm, oom: don't invoke oom killer if current has been reapered To: Tetsuo Handa Cc: Michal Hocko , David Rientjes , Andrew Morton , Linux MM Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 0D6BC1814B0C9 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 Tue, Jul 14, 2020 at 12:06 PM Tetsuo Handa wrote: > > On 2020/07/14 11:58, Yafang Shao wrote: > > On Tue, Jul 14, 2020 at 10:42 AM Tetsuo Handa > > wrote: > >> > >> On 2020/07/14 11:13, Yafang Shao wrote: > >>> But it seems the proposal that using trylock in > >>> mem_cgroup_out_of_memory() should be better? > >>> The trylock could also solve the problem that different processes are > >>> doing oom at the same time. > >> > >> I think trylock is worse. The trylock needlessly wastes CPU time which could > >> have been utilized by the OOM killer/reaper for reclaiming memory. > > > > If it may wastes the CPU time, we can shed it out for 1 second like > > what it does in __alloc_pages_may_oom(): > > > > __alloc_pages_may_oom > > if (!mutex_trylock(&oom_lock)) { > > schedule_timeout_uninterruptible(1); // to avoid wasting CPU time > > 1 second is HZ. 1 means 1 millisecond if CONFIG_HZ=1000. :-) > Right. Thanks for pointing it out :) > > return; > > } > > > > But I find that we doesn't sched it out in pagefault path, > > > > pagefault_out_of_memory > > if (!mutex_trylock(&oom_lock)) > > return; > > > > I haven't thought deeply what the difference is ... > > David Rientjes is proposing it for avoiding soft lockup, and Michal Hocko is refusing it. > How to give the OOM killer/reaper enough CPU time for reclaiming memory is a dogfight. :-( > > https://lkml.kernel.org/r/alpine.DEB.2.21.2003181458100.70237@chino.kir.corp.google.com OK. I will take a look at the discussion in that thread. -- Thanks Yafang