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 ADBA2C433F5 for ; Mon, 18 Oct 2021 09:04:16 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 492EC6054F for ; Mon, 18 Oct 2021 09:04:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 492EC6054F 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 C8ABA900002; Mon, 18 Oct 2021 05:04:15 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C3AF66B0071; Mon, 18 Oct 2021 05:04:15 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B5094900002; Mon, 18 Oct 2021 05:04:15 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0214.hostedemail.com [216.40.44.214]) by kanga.kvack.org (Postfix) with ESMTP id A67566B006C for ; Mon, 18 Oct 2021 05:04:15 -0400 (EDT) Received: from smtpin02.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 5FCDA8249980 for ; Mon, 18 Oct 2021 09:04:15 +0000 (UTC) X-FDA: 78708971670.02.1A8EE66 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by imf06.hostedemail.com (Postfix) with ESMTP id 4BC20801A89B for ; Mon, 18 Oct 2021 09:04:14 +0000 (UTC) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id BE378219B5; Mon, 18 Oct 2021 09:04:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1634547853; 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=z/vHFPDVM8hZbz3viTK/C8vH4oGvJ8bN8OaWpPhCHZA=; b=mlAFk61d8h+oSQO3dORG+kD0uapYz7LR8uzHrxUR/4h6gZrn6tBqFtGaJdXynpE3yHSMNK YL/qsLMTyZgoJD3G7YFKI5VAm27szaLmBj00FcNqg+eOlKtgZ08zzUOrgj0iNDSRFxZ6tc 8kq79DeG+dWHL856++NmRKI+2yWvH40= 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 7424AA3B83; Mon, 18 Oct 2021 09:04:13 +0000 (UTC) Date: Mon, 18 Oct 2021 11:04:13 +0200 From: Michal Hocko To: Vasily Averin Cc: Johannes Weiner , Vladimir Davydov , Andrew Morton , 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 Subject: Re: [PATCH memcg 0/1] false global OOM triggered by memcg-limited task Message-ID: References: <9d10df01-0127-fb40-81c3-cc53c9733c3e@virtuozzo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9d10df01-0127-fb40-81c3-cc53c9733c3e@virtuozzo.com> X-Rspamd-Queue-Id: 4BC20801A89B Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=mlAFk61d; spf=pass (imf06.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.28 as permitted sender) smtp.mailfrom=mhocko@suse.com; dmarc=pass (policy=quarantine) header.from=suse.com X-Stat-Signature: rbuora4eedj9eu4kicb9fg6f41zgxzbi X-Rspamd-Server: rspam05 X-HE-Tag: 1634547854-705816 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 Mon 18-10-21 11:13:52, Vasily Averin wrote: [...] > How could this happen? > > User-space task inside the memcg-limited container generated a page fault, > its handler do_user_addr_fault() called handle_mm_fault which could not > allocate the page due to exceeding the memcg limit and returned VM_FAULT_OOM. > Then do_user_addr_fault() called pagefault_out_of_memory() which executed > out_of_memory() without set of memcg. > > Partially this problem depends on one of my recent patches, disabled unlimited > memory allocation for dying tasks. However I think the problem can happen > on non-killed tasks too, for example because of kmem limit. Could you be more specific on how this can happen without your patch? I have to say I haven't realized this side effect when discussing it. I will be honest that I am not really happy about pagefault_out_of_memory. I have tried to remove it in the past. Without much success back then, unfortunately[1]. Maybe we should get rid of it finally. The OOM is always triggered from inside the allocator where we have much more infromation about the allocation context. A first step would be to skip pagefault_out_of_memory for killed or exiting processes. [1] I do not have msg-id so I cannot provide a lore link but google pointed me to https://www.mail-archive.com/linux-kernel@vger.kernel.org/msg1400402.html -- Michal Hocko SUSE Labs