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 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E335EC433F5 for ; Mon, 25 Oct 2021 09:27:34 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 8F9FE60F4F for ; Mon, 25 Oct 2021 09:27:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 8F9FE60F4F Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id E897D6B0075; Mon, 25 Oct 2021 05:27:33 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E3950940007; Mon, 25 Oct 2021 05:27:33 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D01516B007B; Mon, 25 Oct 2021 05:27:33 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0002.hostedemail.com [216.40.44.2]) by kanga.kvack.org (Postfix) with ESMTP id C1A986B0075 for ; Mon, 25 Oct 2021 05:27:33 -0400 (EDT) Received: from smtpin33.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 84CFC3017D for ; Mon, 25 Oct 2021 09:27:33 +0000 (UTC) X-FDA: 78734431986.33.DC0C37A Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by imf27.hostedemail.com (Postfix) with ESMTP id 1089C7000081 for ; Mon, 25 Oct 2021 09:27:32 +0000 (UTC) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id A9534218ED; Mon, 25 Oct 2021 09:27:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1635154051; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Uc2tQ+I68yRAtsGtLKbNQYmcC3g72eF4Y8qXrabBvYo=; b=eL5EqEnM+gAD4smvMpKMOiv+9odl76GXnxfkil69LbP7b1QC9qpwTW6FHm/g1HnWBxGlXP +aq9ws7dNQAdoxjXGbA2bhTwZgo4fsRHxZeaS6iWMTFi7DgOJRdHUzwUbVQFldcMyVLE+o GmwN4oeHMlbbFtANsg21Juo3XmHpVL4= Received: from suse.cz (unknown [10.100.201.86]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 7546EA3B83; Mon, 25 Oct 2021 09:27:30 +0000 (UTC) Date: Mon, 25 Oct 2021 11:27:29 +0200 From: Michal Hocko To: Vasily Averin Cc: Johannes Weiner , Vladimir Davydov , Andrew Morton , Roman Gushchin , Uladzislau Rezki , Vlastimil Babka , Shakeel Butt , Mel Gorman , Tetsuo Handa , cgroups@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, kernel@openvz.org Subject: Re: [PATCH memcg v3 1/3] mm, oom: pagefault_out_of_memory: don't force global OOM for dying tasks Message-ID: References: <0828a149-786e-7c06-b70a-52d086818ea3@virtuozzo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <0828a149-786e-7c06-b70a-52d086818ea3@virtuozzo.com> X-Stat-Signature: mmwbufcq4hppk7nm7184pro3thg5r95f X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 1089C7000081 Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=eL5EqEnM; dmarc=pass (policy=quarantine) header.from=suse.com; spf=pass (imf27.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.28 as permitted sender) smtp.mailfrom=mhocko@suse.com X-HE-Tag: 1635154052-399494 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 Sat 23-10-21 16:19:28, Vasily Averin wrote: > Any allocation failure during the #PF path will return with VM_FAULT_OOM > which in turn results in pagefault_out_of_memory which in own turn > executes out_out_memory() and can kill a random task. > > An allocation might fail when the current task is the oom victim > and there are no memory reserves left. The OOM killer is already > handled at the page allocator level for the global OOM and at the > charging level for the memcg one. Both have much more information > about the scope of allocation/charge request. This means that > either the OOM killer has been invoked properly and didn't lead > to the allocation success or it has been skipped because it couldn't > have been invoked. In both cases triggering it from here is pointless > and even harmful. > > It makes much more sense to let the killed task die rather than to > wake up an eternally hungry oom-killer and send him to choose a fatter > victim for breakfast. > > Suggested-by: Michal Hocko > Signed-off-by: Vasily Averin Acked-by: Michal Hocko Thanks! > --- > mm/oom_kill.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/mm/oom_kill.c b/mm/oom_kill.c > index 831340e7ad8b..1deef8c7a71b 100644 > --- a/mm/oom_kill.c > +++ b/mm/oom_kill.c > @@ -1137,6 +1137,9 @@ void pagefault_out_of_memory(void) > if (mem_cgroup_oom_synchronize(true)) > return; > > + if (fatal_signal_pending(current)) > + return; > + > if (!mutex_trylock(&oom_lock)) > return; > out_of_memory(&oc); > -- > 2.32.0 -- Michal Hocko SUSE Labs