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=-17.3 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,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 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 DFD6BC4708F for ; Fri, 28 May 2021 12:53:42 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 6263D613F0 for ; Fri, 28 May 2021 12:53:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6263D613F0 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 311B36B006E; Fri, 28 May 2021 08:53:41 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2C1AA8D0001; Fri, 28 May 2021 08:53:41 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1AFBA6B0071; Fri, 28 May 2021 08:53:41 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0163.hostedemail.com [216.40.44.163]) by kanga.kvack.org (Postfix) with ESMTP id DDD756B0070 for ; Fri, 28 May 2021 08:53:40 -0400 (EDT) Received: from smtpin03.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 7DE7C1801E690 for ; Fri, 28 May 2021 12:53:40 +0000 (UTC) X-FDA: 78190631400.03.C0F83B9 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by imf20.hostedemail.com (Postfix) with ESMTP id B0D8937B for ; Fri, 28 May 2021 12:53:28 +0000 (UTC) Received: from imap.suse.de (imap-alt.suse-dmz.suse.de [192.168.254.47]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id B2D5B218B3; Fri, 28 May 2021 12:53:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1622206418; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9CQB6EWZ6xfQcnCaj2E3znJZU9HdjEBg7Abqu1tWIqQ=; b=iV0LyRnJj1ccNBJDvAyJhV75xTk06LrvOshh2YO2gQB8ELXJ8aD0+o7Zl39riZjabuhTed tt6hFo3Rv/ANBzAPsALdB4wsjG2k6DMjjEovLBXnLVTAg60cJjg88RG3IvsfQ5pPeOB/gI 77Z+oLTH1NKqSyMbgHvQavPEfxRjQFk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1622206418; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9CQB6EWZ6xfQcnCaj2E3znJZU9HdjEBg7Abqu1tWIqQ=; b=cBYwmct3DOk0O8sYKqASgki4a4xQrw9S+2lIhjfcx9d6lv7lP0HpNHVBwiErSG0gX66YL0 mAa99vB8lwo7wbDg== Received: from imap3-int (imap-alt.suse-dmz.suse.de [192.168.254.47]) by imap.suse.de (Postfix) with ESMTP id 9EC1611A98; Fri, 28 May 2021 12:53:38 +0000 (UTC) Received: from director2.suse.de ([192.168.254.72]) by imap3-int with ESMTPSA id Kxg7JtLnsGDyNQAALh3uQQ (envelope-from ); Fri, 28 May 2021 12:53:38 +0000 Subject: Re: [PATCH v4] mm/page_alloc: bail out on fatal signal during reclaim/compaction retry attempt To: Aaron Tomlin , linux-mm@kvack.org Cc: akpm@linux-foundation.org, mhocko@suse.com, willy@infradead.org, linux-kernel@vger.kernel.org References: <20210520142901.3371299-1-atomlin@redhat.com> From: Vlastimil Babka Message-ID: Date: Fri, 28 May 2021 14:53:38 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.2 MIME-Version: 1.0 In-Reply-To: <20210520142901.3371299-1-atomlin@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=iV0LyRnJ; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=cBYwmct3; dmarc=none; spf=pass (imf20.hostedemail.com: domain of vbabka@suse.cz designates 195.135.220.28 as permitted sender) smtp.mailfrom=vbabka@suse.cz X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: B0D8937B X-Stat-Signature: rjxxtpjabo683a5adnj9zn3iqqg5jxyn X-HE-Tag: 1622206408-723932 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 5/20/21 4:29 PM, Aaron Tomlin wrote: > A customer experienced a low-memory situation and decided to issue a > SIGKILL (i.e. a fatal signal). Instead of promptly terminating as one > would expect, the aforementioned task remained unresponsive. > > Further investigation indicated that the task was "stuck" in the > reclaim/compaction retry loop. Now, it does not make sense to retry > compaction when a fatal signal is pending. > > In the context of try_to_compact_pages(), indeed COMPACT_SKIPPED can be > returned; albeit, not every zone, on the zone list, would be considered > in the case a fatal signal is found to be pending. > Yet, in should_compact_retry(), given the last known compaction result, > each zone, on the zone list, can be considered/or checked > (see compaction_zonelist_suitable()). For example, if a zone was found > to succeed, then reclaim/compaction would be tried again > (notwithstanding the above). > > This patch ensures that compaction is not needlessly retried > irrespective of the last known compaction result e.g. if it was skipped, > in the unlikely case a fatal signal is found pending. > So, OOM is at least attempted. > > Signed-off-by: Aaron Tomlin Reviewed-by: Vlastimil Babka > --- > mm/page_alloc.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/mm/page_alloc.c b/mm/page_alloc.c > index aaa1655cf682..b317057ac186 100644 > --- a/mm/page_alloc.c > +++ b/mm/page_alloc.c > @@ -4252,6 +4252,9 @@ should_compact_retry(struct alloc_context *ac, int order, int alloc_flags, > if (!order) > return false; > > + if (fatal_signal_pending(current)) > + return false; > + > if (compaction_made_progress(compact_result)) > (*compaction_retries)++; > >