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=-12.9 required=3.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1, USER_IN_DEF_DKIM_WL autolearn=ham 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 729F0C10DCE for ; Thu, 12 Mar 2020 18:07:20 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 3ED562071B for ; Thu, 12 Mar 2020 18:07:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="AncVZ1gc" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3ED562071B Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id C6A556B000A; Thu, 12 Mar 2020 14:07:19 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C191E6B000C; Thu, 12 Mar 2020 14:07:19 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B2DF56B000D; Thu, 12 Mar 2020 14:07:19 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0181.hostedemail.com [216.40.44.181]) by kanga.kvack.org (Postfix) with ESMTP id 99EEB6B000A for ; Thu, 12 Mar 2020 14:07:19 -0400 (EDT) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 5DCEB988E for ; Thu, 12 Mar 2020 18:07:19 +0000 (UTC) X-FDA: 76587492198.18.deer73_3fe2d4f57fa09 X-HE-Tag: deer73_3fe2d4f57fa09 X-Filterd-Recvd-Size: 5597 Received: from mail-pl1-f194.google.com (mail-pl1-f194.google.com [209.85.214.194]) by imf21.hostedemail.com (Postfix) with ESMTP for ; Thu, 12 Mar 2020 18:07:18 +0000 (UTC) Received: by mail-pl1-f194.google.com with SMTP id w12so2954151pll.13 for ; Thu, 12 Mar 2020 11:07:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=o5Rs9S0RYunQW4vpCbkDqGUyyhPOaydkpJow5/jb/es=; b=AncVZ1gcQLTl82u2dTBzHwOLmeA0NJKMbQrX2PCLBsijaiX2atkSN9hoqI5Qb9Npx3 8GaIyWKe2T+f3rJk9RzzXQvZCz65ujA0Onk1Krr2sLslYH2+Ej0b5HDR/Z7+nA7cKvv9 r3niug17WALbTsxFhepXZT41hlg5nsQurA6/uCQTafgAFIH/wehKB6T2dlHwgkWPGauz zo75aSP9c7eqrU9821PiMNY5XtBF9RQlmaqAvWKIi1b+8qcXzEDWbArHW/eL6vqrpqpu wDzxTcsPCVCzbYiCPYsfZEZD6stNOsNK1RcP4yLw5qLo75IdiEoIsLtKQ1KDcsDH10qc 9pCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=o5Rs9S0RYunQW4vpCbkDqGUyyhPOaydkpJow5/jb/es=; b=AWq2Ua72RvgsdXWq99OCs2Nb2n5v+Z02Ux7bxy1fzT4SWoVTB+QQmmiiWAT5vcMNU4 kXrrKDDox6Ltxkw3fWe7tFS9GgM7rhKtmbgiprXY6yPpU6Pg+RW7TB/kZRuCjuCBFLvT ISMeFb0IRgCDet4TWOH4/c8r8CRCJrvpCoqE7ImvdRcUvB0+UfsgU6jiIsaN/Uy5bv5k 4eEa9dbDUi+Q2BWR7d/qJ2rIrf7AKHeEfhOLn3s6AGpiXXI8BziuCRrptfVpB4C3OYVI 7zMmCfaXIJDFTAfV+JiF6XNdWNKlrqlO4slVm9wEBgqARhtfCtHwHSmM8D1y5Z0jk44e /tdA== X-Gm-Message-State: ANhLgQ1pIIQ7rRymEeAWWCHCCLgUx7R+2k5gWGg5L6E6rK2Q3J8kzT3Q rVrBRy6DFqp332luEiN9zX+c0A== X-Google-Smtp-Source: ADFU+vsZ2i5IaQQYazSCYmNou7CThfHcLBtO490lloSMclgQlcjk8rpyVT2JOpYqkc4ADG591zTA5A== X-Received: by 2002:a17:902:db83:: with SMTP id m3mr9039744pld.133.1584036437569; Thu, 12 Mar 2020 11:07:17 -0700 (PDT) Received: from [2620:15c:17:3:3a5:23a7:5e32:4598] ([2620:15c:17:3:3a5:23a7:5e32:4598]) by smtp.gmail.com with ESMTPSA id e18sm9603469pjt.41.2020.03.12.11.07.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Mar 2020 11:07:16 -0700 (PDT) Date: Thu, 12 Mar 2020 11:07:15 -0700 (PDT) From: David Rientjes X-X-Sender: rientjes@chino.kir.corp.google.com To: Tetsuo Handa cc: Andrew Morton , Vlastimil Babka , Michal Hocko , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [patch] mm, oom: prevent soft lockup on memcg oom for UP systems In-Reply-To: <202003120012.02C0CEUB043533@www262.sakura.ne.jp> Message-ID: References: <993e7783-60e9-ba03-b512-c829b9e833fd@i-love.sakura.ne.jp> <202003120012.02C0CEUB043533@www262.sakura.ne.jp> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII 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 Thu, 12 Mar 2020, Tetsuo Handa wrote: > > On Thu, 12 Mar 2020, Tetsuo Handa wrote: > > > > If you have an alternate patch to try, we can test it. But since this > > > > cond_resched() is needed anyway, I'm not sure it will change the result. > > > > > > schedule_timeout_killable(1) is an alternate patch to try; I don't think > > > that this cond_resched() is needed anyway. > > > > > > > You are suggesting schedule_timeout_killable(1) in shrink_node_memcgs()? > > > > Andrew Morton also mentioned whether cond_resched() in shrink_node_memcgs() > is enough. But like you mentioned, > It passes our testing because this is where the allocator is looping while the victim is trying to exit if only it could be scheduled. > you can try re-adding sleep outside of oom_lock: > > diff --git a/mm/memcontrol.c b/mm/memcontrol.c > index d09776cd6e10..3aee7e0eca4e 100644 > --- a/mm/memcontrol.c > +++ b/mm/memcontrol.c > @@ -1576,6 +1576,7 @@ static bool mem_cgroup_out_of_memory(struct mem_cgroup *memcg, gfp_t gfp_mask, > */ > ret = should_force_charge() || out_of_memory(&oc); > mutex_unlock(&oom_lock); > + schedule_timeout_killable(1); > return ret; > } > If current was process chosen for oom kill, this would actually induce the problem, not fix it. > diff --git a/mm/page_alloc.c b/mm/page_alloc.c > index 3c4eb750a199..e80158049651 100644 > --- a/mm/page_alloc.c > +++ b/mm/page_alloc.c > @@ -3797,7 +3797,6 @@ __alloc_pages_may_oom(gfp_t gfp_mask, unsigned int order, > */ > if (!mutex_trylock(&oom_lock)) { > *did_some_progress = 1; > - schedule_timeout_uninterruptible(1); > return NULL; > } > > @@ -4590,6 +4589,7 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order, > > /* Retry as long as the OOM killer is making progress */ > if (did_some_progress) { > + schedule_timeout_uninterruptible(1); > no_progress_loops = 0; > goto retry; > } > > By the way, will you share the reproducer (and how to use the reproducer) ? > On an UP kernel with swap disabled, you limit a memcg to 100MB and start three processes that each fault 40MB attached to it. Same reproducer as the "mm, oom: make a last minute check to prevent unnecessary memcg oom kills" patch except in that case there are two cores.