Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp364478pxj; Fri, 28 May 2021 05:59:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx11Woy/k7QOg2SiD1vM3I/fcaIIKgfdoLMzy6JXBZXawRbpqHTilVe5OoIYo53QanvKTXa X-Received: by 2002:a17:906:4e09:: with SMTP id z9mr8945778eju.156.1622206751699; Fri, 28 May 2021 05:59:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622206751; cv=none; d=google.com; s=arc-20160816; b=sKNd9w9+ln7FQt0WgQDjA5jgssmMV2ow/+UrtM+lLxijQUSuka8t2FMYEppfz6zc3o cTZpm1a0+MVrA/chcM3A69txTzxY3IDxHv724wqvybG7cd/zVo++ZoV0Hu9yr0Ke94Sb mS/4C1oHwuUwZNqD8NR7hjH0sMtur0o0ZaMR5V+sSI8zPwr9ggihBU6YKDQMNUyPwRJ6 TQGpaoVu/IaHUqf8Iz6K3/fYJuAYMzQvboDfvbfQwd88hPniBrHNToAM73IehvUvmfb3 Ls/jBnHMMxJFWiLXqKrr5kbRqOqbJdSuxQinXcKbAbSNwdI/Wa6lP9WbRcTaTAdiQ5MY KBOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature:dkim-signature; bh=9CQB6EWZ6xfQcnCaj2E3znJZU9HdjEBg7Abqu1tWIqQ=; b=TR5cJw+ITEwObK1hU6+ej5IZ6HMajXC463S4c4s+1V7DKbsSWA++k4aac4+XUFwhtD 5IzXRosX2Mi6dovQD0Tyj1kWcTRgDleLAkgS9cWoPo+3FX4pjjkrvzdPkO9FDxy7TJ07 5Iwv2mneNEBpo69j6WbElxy59z8AYuyJSfNspFQaiOSSRDmlPjxXnsk/RGrxHV+RbvhA 8duCHwTG0CrapCH5fQnsDDgakG5nIKIvgFgnHV8QL6kcsaOHtU/ayiFXnbHZiLNqWJJf CmRkShoGZ6tlwA6sAfINYRLzPeheoy5JeUYghYR3BdLlQhu3l1g/b7oMYNHawhJsGBUm AGiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=iV0LyRnJ; dkim=neutral (no key) header.i=@suse.cz header.b=cBYwmct3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i2si5673890ejp.119.2021.05.28.05.58.47; Fri, 28 May 2021 05:59:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=iV0LyRnJ; dkim=neutral (no key) header.i=@suse.cz header.b=cBYwmct3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235043AbhE1MzO (ORCPT + 99 others); Fri, 28 May 2021 08:55:14 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:33492 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229552AbhE1MzO (ORCPT ); Fri, 28 May 2021 08:55:14 -0400 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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)++; > >