From patchwork Wed May 19 20:17:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aaron Tomlin X-Patchwork-Id: 12268477 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=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT 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 2DE53C433B4 for ; Wed, 19 May 2021 20:17:50 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id A04AA611AD for ; Wed, 19 May 2021 20:17:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A04AA611AD Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 2413A6B0072; Wed, 19 May 2021 16:17:49 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1EF576B0073; Wed, 19 May 2021 16:17:49 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 090AE6B0074; Wed, 19 May 2021 16:17:49 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0030.hostedemail.com [216.40.44.30]) by kanga.kvack.org (Postfix) with ESMTP id C98D16B0072 for ; Wed, 19 May 2021 16:17:48 -0400 (EDT) Received: from smtpin09.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 66D9F98BA for ; Wed, 19 May 2021 20:17:48 +0000 (UTC) X-FDA: 78159091416.09.57DE744 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf26.hostedemail.com (Postfix) with ESMTP id C52F440B8CC9 for ; Wed, 19 May 2021 20:17:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1621455467; h=from:from:reply-to:subject:subject: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=FVWmqrHmN8k1tD/caQDTal6fqjCBCOWgYK0fgUgjsDY=; b=QvT0gM30qUSWb1cXh0hkjFxAfkPT6bDBDIbF7KbWPIpq+z3XcW/m880mXmaw8TdO2giWGg FsOhqSd/XVF9lNwzSKJRWTMsmK7bC32rz4+Fjmumtkorockzcc9lmq5FxCbBVt3u/OQedX +bG90ktLuM91JbkDPTjJ1xmurpLgqXo= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-260-xqDprp6CN7iJUKHSp_LrGQ-1; Wed, 19 May 2021 16:17:46 -0400 X-MC-Unique: xqDprp6CN7iJUKHSp_LrGQ-1 Received: by mail-wr1-f69.google.com with SMTP id x10-20020adfc18a0000b029010d83c83f2aso7634081wre.8 for ; Wed, 19 May 2021 13:17:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=FVWmqrHmN8k1tD/caQDTal6fqjCBCOWgYK0fgUgjsDY=; b=dDGnrZERDx6IpRwhhk5dVo9tcETYqbp03t5IXt6ko31W1ZMKZ8TXi/87K3YWfK8of4 10ZepK7qI4+NsawOz03XCJzj1uGyH+es/N8/hWmquA05LZe0tIDcPhMHkkFVj4cajui9 kJQacJoMHEHynlswuE4dTPbFAhnUa197dkgS9QH/s2EM36+AzXv+J9Vyfroj6IZ2Tnmz 8b8e4ZoTHno3ccoRKOh9sPIjDhruYDQEtMkfox7L7DX3+0zJjx+Kkk6i2mNkS2Hh8P2G 155YCICk+xkYs9Dzbogs24zlLpuD7maSxa5aYo/FpkOkUXvF/vALvRbPx2k34cly4GXx ctsg== X-Gm-Message-State: AOAM5314ndrUVdGjkEi4jiPvlkWm+uHG+p0pOr3c2HJSrWez5FqSC+tq R6cbnVFITb731BKRp1d02P0oquTHG5JP8mnnkV31YZLHjPz9XPtE4OsTjunsLEKS8lPnQOiHFWZ yTSNRt9cJJNISfWDPGyk8XA2JDSNt0MJqvc0fMn3Xu2fp+1e8hf32dVK9onIc X-Received: by 2002:adf:faca:: with SMTP id a10mr701570wrs.9.1621455464814; Wed, 19 May 2021 13:17:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzYEc9LRcRWaH8SeBjkhf17hx8NzdqxOG8U3gTeobgD/L+twK8rDMC44kE6H4Bc4EtVflBAeA== X-Received: by 2002:adf:faca:: with SMTP id a10mr701551wrs.9.1621455464542; Wed, 19 May 2021 13:17:44 -0700 (PDT) Received: from localhost (cpc111743-lutn13-2-0-cust979.9-3.cable.virginm.net. [82.17.115.212]) by smtp.gmail.com with ESMTPSA id p6sm474549wma.4.2021.05.19.13.17.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 May 2021 13:17:44 -0700 (PDT) From: Aaron Tomlin To: linux-mm@kvack.org Cc: akpm@linux-foundation.org, vbabka@suse.cz, mhocko@suse.com, willy@infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v3] mm/page_alloc: bail out on fatal signal during reclaim/compaction retry attempt Date: Wed, 19 May 2021 21:17:43 +0100 Message-Id: <20210519201743.3260890-1-atomlin@redhat.com> X-Mailer: git-send-email 2.26.3 In-Reply-To: References: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=QvT0gM30; spf=none (imf26.hostedemail.com: domain of atomlin@redhat.com has no SPF policy when checking 170.10.133.124) smtp.mailfrom=atomlin@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: C52F440B8CC9 X-Stat-Signature: k5c4kfnq1cses4i6me8tktimtz6bdraa X-HE-Tag: 1621455467-763751 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: 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 --- 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)++;