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=-1.0 required=3.0 tests=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 9DE9CC10F29 for ; Tue, 17 Mar 2020 07:59:43 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 5780D20674 for ; Tue, 17 Mar 2020 07:59:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5780D20674 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id F39326B0005; Tue, 17 Mar 2020 03:59:42 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EC2E16B0006; Tue, 17 Mar 2020 03:59:42 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DB1A96B0007; Tue, 17 Mar 2020 03:59:42 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0199.hostedemail.com [216.40.44.199]) by kanga.kvack.org (Postfix) with ESMTP id BF42B6B0005 for ; Tue, 17 Mar 2020 03:59:42 -0400 (EDT) Received: from smtpin03.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id AE983180AD815 for ; Tue, 17 Mar 2020 07:59:42 +0000 (UTC) X-FDA: 76604105004.03.fall18_8ef6f190f250d X-HE-Tag: fall18_8ef6f190f250d X-Filterd-Recvd-Size: 4959 Received: from mail-wr1-f65.google.com (mail-wr1-f65.google.com [209.85.221.65]) by imf20.hostedemail.com (Postfix) with ESMTP for ; Tue, 17 Mar 2020 07:59:42 +0000 (UTC) Received: by mail-wr1-f65.google.com with SMTP id s5so24385323wrg.3 for ; Tue, 17 Mar 2020 00:59:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=COSdnxnIOsN3EOb8hRM3mTHRvlfS3wYkyMMxHIL4X4U=; b=m+kLhC+4JAv58+iE/XEzrxjqNjU0JWr5mCTC/kmDJZJaspeJDNViSaNT8566s3VkI2 IH/R5WTgqQevu/UWGvd8Nk11CVb9eq7jU7u7gckBYOZ5rtmGw0BbXTyhl2ErqM7wtK07 bq/J9G8qhn54SBwfROgRnAACX90YLFcgyGCDYz/TsJCk5saUoQTsnO/68Uj2eZjacnzy LSf+EEQaBRIeWte6Lz3nB9CTiIUuIxP3SnzDsuDCIveNW4HbzOvrXy7dxGfWcIl5dMNJ TkaxNNOGuzfC7n0qpbVgOavlOU2s/oBoWgpjyMs4TqenaGipN1wTnVUzLHeFvSrKzfsl 0cDQ== X-Gm-Message-State: ANhLgQ1HzLU5RA+yfhcaWcGZmoE3uGErLukil98z0EvQCzYQwR2KGnGM Z1gCmGCuB14TrvFsw4c80l8cWtEk X-Google-Smtp-Source: ADFU+vuwKantGoDyxWPeXBYjQjtbjYm5qNqzH0vpREbbQTITnn51vvyBJ7rwuV3Mw+wIV2o2vgzf0g== X-Received: by 2002:adf:bb06:: with SMTP id r6mr4533468wrg.324.1584431981101; Tue, 17 Mar 2020 00:59:41 -0700 (PDT) Received: from localhost (ip-37-188-255-121.eurotel.cz. [37.188.255.121]) by smtp.gmail.com with ESMTPSA id x13sm3150071wmj.5.2020.03.17.00.59.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Mar 2020 00:59:40 -0700 (PDT) Date: Tue, 17 Mar 2020 08:59:39 +0100 From: Michal Hocko To: Robert Kolchmeyer , David Rientjes Cc: Andrew Morton , Vlastimil Babka , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [patch] mm, oom: make a last minute check to prevent unnecessary memcg oom kills Message-ID: <20200317075939.GD26018@dhcp22.suse.cz> References: <20200310221938.GF8447@dhcp22.suse.cz> <20200311083900.GC23944@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200311083900.GC23944@dhcp22.suse.cz> 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 Wed 11-03-20 09:39:01, Michal Hocko wrote: > On Tue 10-03-20 15:54:44, David Rientjes wrote: > > On Tue, 10 Mar 2020, Michal Hocko wrote: > > > > > On Tue 10-03-20 14:55:50, David Rientjes wrote: > > > > Killing a user process as a result of hitting memcg limits is a serious > > > > decision that is unfortunately needed only when no forward progress in > > > > reclaiming memory can be made. > > > > > > > > Deciding the appropriate oom victim can take a sufficient amount of time > > > > that allows another process that is exiting to actually uncharge to the > > > > same memcg hierarchy and prevent unnecessarily killing user processes. > > > > > > > > An example is to prevent *multiple* unnecessary oom kills on a system > > > > with two cores where the oom kill occurs when there is an abundance of > > > > free memory available: > > > > > > > > Memory cgroup out of memory: Killed process 628 (repro) total-vm:41944kB, anon-rss:40888kB, file-rss:496kB, shmem-rss:0kB, UID:0 pgtables:116kB oom_score_adj:0 > > > > > > > > repro invoked oom-killer: gfp_mask=0xcc0(GFP_KERNEL), order=0, oom_score_adj=0 > > > > CPU: 1 PID: 629 Comm: repro Not tainted 5.6.0-rc5+ #130 > > > > Call Trace: > > > > dump_stack+0x78/0xb6 > > > > dump_header+0x55/0x240 > > > > oom_kill_process+0xc5/0x170 > > > > out_of_memory+0x305/0x4a0 > > > > try_charge+0x77b/0xac0 > > > > mem_cgroup_try_charge+0x10a/0x220 > > > > mem_cgroup_try_charge_delay+0x1e/0x40 > > > > handle_mm_fault+0xdf2/0x15f0 > > > > do_user_addr_fault+0x21f/0x420 > > > > async_page_fault+0x2f/0x40 > > > > memory: usage 61336kB, limit 102400kB, failcnt 74 > > > > > > > > Notice the second memcg oom kill shows usage is >40MB below its limit of > > > > 100MB but a process is still unnecessarily killed because the decision has > > > > already been made to oom kill by calling out_of_memory() before the > > > > initial victim had a chance to uncharge its memory. > > > > > > Could you be more specific about the specific workload please? > > > > > > > Robert, could you elaborate on the user-visible effects of this issue that > > caused it to initially get reported? > > Yes please, real life usecases are important when adding hacks like this > one and we should have a clear data to support the check actually helps > (in how many instances etc...) Friendly ping. -- Michal Hocko SUSE Labs