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 9ED59C433EF for ; Tue, 26 Oct 2021 14:07:46 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 43E8860F90 for ; Tue, 26 Oct 2021 14:07:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 43E8860F90 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 C7211940008; Tue, 26 Oct 2021 10:07:45 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C214F940007; Tue, 26 Oct 2021 10:07:45 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AE96C940008; Tue, 26 Oct 2021 10:07:45 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0098.hostedemail.com [216.40.44.98]) by kanga.kvack.org (Postfix) with ESMTP id 98747940007 for ; Tue, 26 Oct 2021 10:07:45 -0400 (EDT) Received: from smtpin38.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 53A6239F2D for ; Tue, 26 Oct 2021 14:07:45 +0000 (UTC) X-FDA: 78738766890.38.D1271DE Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by imf21.hostedemail.com (Postfix) with ESMTP id B1CA6D036A42 for ; Tue, 26 Oct 2021 14:07:41 +0000 (UTC) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 50F5C1F770; Tue, 26 Oct 2021 14:07:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1635257263; 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=sW8fX/bIkRavS2IM2SW67s4/k2HA13rrU7KuzOI/OYA=; b=XLQpg2KAcIM7gQTqzvrzY5Igd4UdGIws6JdRiIfbJQ8F1ubXcXk+95Wocng0fDJL/i/Ivg +OQ//LuLM9kDN56S0F6gBVNZDMP9o95FO5Zp3iFWP01ds7iy0/TOwJlitIe5kfi10yAwSG 408Z8qmYPv7D5KNsFCV4RRii8RLmGfk= 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 C6A66A3B85; Tue, 26 Oct 2021 14:07:41 +0000 (UTC) Date: Tue, 26 Oct 2021 16:07:41 +0200 From: Michal Hocko To: Tetsuo Handa Cc: Vasily Averin , Roman Gushchin , Uladzislau Rezki , Vlastimil Babka , Shakeel Butt , Mel Gorman , cgroups@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, kernel@openvz.org, Johannes Weiner , Vladimir Davydov , Andrew Morton Subject: Re: [PATCH memcg v3 2/3] mm, oom: do not trigger out_of_memory from the #PF Message-ID: References: <62a326bc-37d2-b8c9-ddbf-7adaeaadf341@i-love.sakura.ne.jp> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <62a326bc-37d2-b8c9-ddbf-7adaeaadf341@i-love.sakura.ne.jp> X-Stat-Signature: pqzngakp6wi6yctz5wwx9s9tmgszgtkr X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: B1CA6D036A42 Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=XLQpg2KA; dmarc=pass (policy=quarantine) header.from=suse.com; spf=pass (imf21.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.29 as permitted sender) smtp.mailfrom=mhocko@suse.com X-HE-Tag: 1635257261-27456 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 26-10-21 22:56:44, Tetsuo Handa wrote: > On 2021/10/25 17:04, Michal Hocko wrote: > > I do not think there is any guarantee. This code has meant to be a > > safeguard but it turns out to be adding more harm than a safety. There > > are several scenarios mentioned in this thread where this would be > > counter productive or outright wrong thing to do. > > Setting PR_IO_FLUSHER via prctl(PR_SET_IO_FLUSHER) + hitting legacy kmem > charge limit might be an unexpected combination? I am not sure I follow or why PR_SET_IO_FLUSHER should be relevant. But triggering the global OOM killer on kmem charge limit failure is certainly not the right thing to do. Quite opposite because this would be effectivelly a global DoS as a result of a local memory constrain. > > On the other hand it is hard to imagine any legitimate situation where > > this would be a right thing to do. Maybe you have something more > > specific in mind? What would be the legit code to rely on OOM handling > > out of the line (where the details about the allocation scope is lost)? > > I don't have specific scenario, but I feel that it might be a chance to > retry killable vmalloc(). Commit b8c8a338f75e ("Revert "vmalloc: back off > when the current task is killed"") was 4.5 years ago, and fuzz testing found > many bugs triggered by memory allocation fault injection. Thus, I think that > the direction is going towards "we can fail memory allocation upon SIGKILL > (rather than worrying about depleting memory reserves and/or escalating to > global OOM killer invocations)". Most memory allocation requests which > allocate memory for userspace process are willing to give up upon SIGKILL. > > Like you are trying to add NOFS, NOIO, NOFAIL support to vmalloc(), you could > consider KILLABLE support as well. Of course, direct reclaim makes it difficult > to immediately give up upon SIGKILL, but killable allocation sounds still nice > even if best-effort basis. This is all fine but I am not sure how this is realated to this patch. The previous patch already gives up in pagefault_out_of_memory on fatal signal pending. So this code is not really reachable. Also alowing more allocations to fail doesn't really suggest that we should trigger OOM killer from #PF. I would argue that the opposite is the case actually. Or I just haven't understood your concern? -- Michal Hocko SUSE Labs