Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1520342pxb; Tue, 26 Oct 2021 10:29:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwd1ikBN7t/TVs7GcNLP04NsKj7Qx1/h5cy0Glv3ihP+qrco4X0X2qhA0lou+XwZbkmzqw/ X-Received: by 2002:a17:902:ce82:b0:140:266e:df73 with SMTP id f2-20020a170902ce8200b00140266edf73mr23969933plg.0.1635269343776; Tue, 26 Oct 2021 10:29:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635269343; cv=none; d=google.com; s=arc-20160816; b=k8EJtBdVooAmyuMELoaMwZ6PciHKbF58isRmoMy0E6fWrdoOrHX2+5iFoJXjmdRe0z u5nBFCxTjFDimrVyoQZNMDxFQecvadxu7yXNk7HPA5y1WhyJ7VO7a9p+KS/kw1MoU3Oj fYxpBIPAgnbVEwYEJyQtiyrDZDasxmWXbjaH4/Pr+d9ua97FIEC5sld5tYVWOBtWEc5G dF8VTFhlcSTAB3qBNm4yfRPuMBc+seLNxxP5VhSLAeK3PdSJzDcUGzIeu6e7M+BgnNCD /xlQxrKgl9Q7AuSDngJ6zG2uoKOPq9XVs3ZAhpg4nNaP/WNdUbRFxbiglRLKwNQInY5F yxvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=sW8fX/bIkRavS2IM2SW67s4/k2HA13rrU7KuzOI/OYA=; b=Xb+MghkIzd8U43i+AS7K4TBbAGZRNW/Rg/RWCJONiAaFi8veSBRxdoy4el4ZGSLJbK PAO6So2kcg+896QgIzcP9pKFxOkLi5rBLGcgpJ0+FvCsKvzX0LRF1r1H1F0JhlXPc8S/ 4diKIgUua6b9wp7uuP8t1Y6P6kyg+d7iJvKkn20GgJ75mYQ2Rs2L6+YZYdP8NwML9XH8 vsS4sjZkWLpdHPNBwSlSFvTXAavMYRcNtJPUtSRJY6G+i+Ke57ndEF3c/w6VqowcrA5b Y0kOOxdwDg2TIyUVEfYfFHSVEKDlIhCRv3OSDx/LCjOeiDWefPW7o7GOufldZGoY6oZb Zn1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=XLQpg2KA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s15si3163114pfu.0.2021.10.26.10.28.51; Tue, 26 Oct 2021 10:29:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=XLQpg2KA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236374AbhJZOKI (ORCPT + 99 others); Tue, 26 Oct 2021 10:10:08 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]:34714 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230073AbhJZOKI (ORCPT ); Tue, 26 Oct 2021 10:10:08 -0400 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> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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