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 283E8C433F5 for ; Wed, 20 Oct 2021 13:02:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0BE2A60249 for ; Wed, 20 Oct 2021 13:02:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230177AbhJTNEg (ORCPT ); Wed, 20 Oct 2021 09:04:36 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:46044 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229817AbhJTNEf (ORCPT ); Wed, 20 Oct 2021 09:04:35 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id E60D121A87; Wed, 20 Oct 2021 13:02:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1634734939; 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=lHtiz45zVS7aEG3jw5dxC6PErBuqUS5lB4tXnXaQ6pg=; b=Y/I+Ce5axakhGBIRNKOegdQVHdI4YzYHQEIpdgO0UXNG8VzJ/LYJYwmJOdM6opVpOjv+9L FEfoascr1IWjpMCUhwxtd/BXj4wwJxLQ7Usqx/t/XNvQuA+jG11qL34rmbcJrfJoSQZlqL aCmzO/x/CQnYKUqQcQQjTuPUiYqW6QY= 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 96830A3B81; Wed, 20 Oct 2021 13:02:19 +0000 (UTC) Date: Wed, 20 Oct 2021 15:02:19 +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 3/3] memcg: handle memcg oom failures Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed 20-10-21 15:14:27, Vasily Averin wrote: > mem_cgroup_oom() can fail if current task was marked unkillable > and oom killer cannot find any victim. > > Currently we force memcg charge for such allocations, > however it allow memcg-limited userspace task in to overuse assigned limits > and potentially trigger the global memory shortage. You should really go into more details whether that is a practical problem to handle. OOM_FAILED means that the memcg oom killer couldn't find any oom victim so it cannot help with a forward progress. There are not that many situations when that can happen. Naming that would be really useful. > Let's fail the memory charge in such cases. > > This failure should be somehow recognised in #PF context, explain why > so let's use current->memcg_in_oom == (struct mem_cgroup *)OOM_FAILED > > ToDo: what is the best way to notify pagefault_out_of_memory() about > mem_cgroup_out_of_memory failure ? why don't you simply remove out_of_memory from pagefault_out_of_memory and leave it only with the blocking memcg OOM handling? Wouldn't that be a more generic solution? Your first patch already goes that way partially. This change is more risky than the first one. If somebody returns VM_FAULT_OOM without invoking allocator then it can loop for ever but invoking OOM killer in such a situation is equally wrong as the oom killer cannot really help, right? -- Michal Hocko SUSE Labs