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 X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 51329C47094 for ; Mon, 7 Jun 2021 20:31:06 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id CD28F61153 for ; Mon, 7 Jun 2021 20:31:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CD28F61153 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 4A5F46B006C; Mon, 7 Jun 2021 16:31:05 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 455F86B006E; Mon, 7 Jun 2021 16:31:05 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2F7876B0070; Mon, 7 Jun 2021 16:31:05 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0001.hostedemail.com [216.40.44.1]) by kanga.kvack.org (Postfix) with ESMTP id F327F6B006C for ; Mon, 7 Jun 2021 16:31:04 -0400 (EDT) Received: from smtpin34.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 895B5C5C9 for ; Mon, 7 Jun 2021 20:31:04 +0000 (UTC) X-FDA: 78228072048.34.3C698BA Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by imf17.hostedemail.com (Postfix) with ESMTP id 1723242D31C6 for ; Mon, 7 Jun 2021 20:30:49 +0000 (UTC) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 2254C1FD33; Mon, 7 Jun 2021 19:04:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1623092650; 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=MIqVGJKzmXDAXOFL3y218dPmkQhomVPxHjxGP6cf2oI=; b=GZMRzh8DRwl34CCsYB7uzZzw7/3QHpZPSy/CukU5wHHXg4ADhpNopRhKVM2v0vP1/LyBfY TQ0Y6v/E9puRcL8+Ez8cYRIDnHDdp1dhwc0QDaYCzYY2z3+DqkFCR3mUZU+1RkBGRUjRnS RUX9aRoLcCn+q7h59A0NqY5diXpRuD0= 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 EA41DA3BDE; Mon, 7 Jun 2021 19:04:09 +0000 (UTC) Date: Mon, 7 Jun 2021 21:04:09 +0200 From: Michal Hocko To: Waiman Long Cc: Shakeel Butt , Aaron Tomlin , Linux MM , Andrew Morton , Vlastimil Babka , LKML Subject: Re: [RFC PATCH] mm/oom_kill: allow oom kill allocating task for non-global case Message-ID: References: <20210607163103.632681-1-atomlin@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 1723242D31C6 X-Stat-Signature: y3gzmcwd6p7andekpm7s3tzeh7pfytkg Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=GZMRzh8D; dmarc=pass (policy=quarantine) header.from=suse.com; spf=pass (imf17.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.29 as permitted sender) smtp.mailfrom=mhocko@suse.com X-HE-Tag: 1623097849-558866 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 07-06-21 14:51:05, Waiman Long wrote: > On 6/7/21 2:43 PM, Shakeel Butt wrote: > > On Mon, Jun 7, 2021 at 9:45 AM Waiman Long wrote: > > > On 6/7/21 12:31 PM, Aaron Tomlin wrote: > > > > At the present time, in the context of memcg OOM, even when > > > > sysctl_oom_kill_allocating_task is enabled/or set, the "allocating" > > > > task cannot be selected, as a target for the OOM killer. > > > > > > > > This patch removes the restriction entirely. > > > > > > > > Signed-off-by: Aaron Tomlin > > > > --- > > > > mm/oom_kill.c | 6 +++--- > > > > 1 file changed, 3 insertions(+), 3 deletions(-) > > > > > > > > diff --git a/mm/oom_kill.c b/mm/oom_kill.c > > > > index eefd3f5fde46..3bae33e2d9c2 100644 > > > > --- a/mm/oom_kill.c > > > > +++ b/mm/oom_kill.c > > > > @@ -1089,9 +1089,9 @@ bool out_of_memory(struct oom_control *oc) > > > > oc->nodemask = NULL; > > > > check_panic_on_oom(oc); > > > > > > > > - if (!is_memcg_oom(oc) && sysctl_oom_kill_allocating_task && > > > > - current->mm && !oom_unkillable_task(current) && > > > > - oom_cpuset_eligible(current, oc) && > > > > + if (sysctl_oom_kill_allocating_task && current->mm && > > > > + !oom_unkillable_task(current) && > > > > + oom_cpuset_eligible(current, oc) && > > > > current->signal->oom_score_adj != OOM_SCORE_ADJ_MIN) { > > > > get_task_struct(current); > > > > oc->chosen = current; > > > To provide more context for this patch, we are actually seeing that in a > > > customer report about OOM happened in a container where the dominating > > > task used up most of the memory and it happened to be the task that > > > triggered the OOM with the result that no killable process could be > > > found. > > Why was there no killable process? What about the process allocating > > the memory or is this remote memcg charging? > > It is because the other processes have a oom_adjust_score of -1000. So they > are non-killable. Anyway, they don't consume that much memory and killing > them won't free up that much. > > The other process that uses most of the memory is the one that trigger the > OOM kill in the first place because the memory limit has been reached in new > memory allocation. Based on the current logic, this process cannot be killed > at all even if we set the oom_kill_allocating_task to 1 if the OOM happens > only within the memcg context, not in a global OOM situation. This patch is > to allow this process to be killed under this circumstance. Do you have the oom report? I do not see why the allocating task hasn't been chosen. -- Michal Hocko SUSE Labs