From patchwork Wed May 19 14:50:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aaron Tomlin X-Patchwork-Id: 12267803 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 16996C433B4 for ; Wed, 19 May 2021 14:50:22 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 9528C61001 for ; Wed, 19 May 2021 14:50:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9528C61001 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 2E57D6B006E; Wed, 19 May 2021 10:50:21 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2BCF76B0070; Wed, 19 May 2021 10:50:21 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1640C6B0071; Wed, 19 May 2021 10:50:21 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0215.hostedemail.com [216.40.44.215]) by kanga.kvack.org (Postfix) with ESMTP id DBB806B006E for ; Wed, 19 May 2021 10:50:20 -0400 (EDT) Received: from smtpin06.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 7ED3E824999B for ; Wed, 19 May 2021 14:50:20 +0000 (UTC) X-FDA: 78158266200.06.07EAB18 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by imf18.hostedemail.com (Postfix) with ESMTP id 684CD20007EF for ; Wed, 19 May 2021 14:50:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1621435819; 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=XbWgytZuqM4UIpt46ERdKUKnppPb4ehKqu8JICqxcZw=; b=dhk/9T6rWKYQgJdl5Ltu/ayvZbgdCyfCLn7lx+zgqdKxu9BfQmKZ6Xvz9nE2V4E4RJEMZ+ aWDcnCDgxmo4Y4lmCofAyA9+nvv9CFi6rVomJhkFIsJEdbiVduHzMnSRfhO1A9lspf+IL7 bbxj9XY9LVdIOPhBEGlOt+qBT5zV8FM= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-253-1ONgZcSaOBKMKsTyXcM6UQ-1; Wed, 19 May 2021 10:50:18 -0400 X-MC-Unique: 1ONgZcSaOBKMKsTyXcM6UQ-1 Received: by mail-wr1-f70.google.com with SMTP id 93-20020adf80e60000b0290106fab45006so7245607wrl.20 for ; Wed, 19 May 2021 07:50:17 -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=XbWgytZuqM4UIpt46ERdKUKnppPb4ehKqu8JICqxcZw=; b=YweUzALKQPIi4MPU+PXOGL28Oeou3AEWoIhKdBjA9B9GVA9lcjlmMiewAIqz1oTYr3 IBXIH86g19H0s6kSasJNvw8XggiM7jePgJB7rX+ThFwIApAkITUlOgAHdTMmKdCBfNPR UjAB+CVrL9gL9GdMIQeaocyP/K9d9TxWT5uFqIXiuvp8pv2rVyZUfh7qWESnLetfek0x lmuw3QlWZDbqH9QaQEG2lczQWTo/QSttafviEUxOoq466kQD9a3DQuCsCGJWpyftGbTC P8gYbKXHqtuOn8uIt9GwfQQdRpmq1u6bmhr43fEt/I35fZ2qKFuGRDa3kMONEqmYkWvU C2Qg== X-Gm-Message-State: AOAM532tyFK1buhS1fntOLGwqe0dlKolPsGLOu7i8HMd4CQdMibTdgL6 anu0GIFcUrY+nYtKTUn6tkPpVXmO7U9RP8yWAHEPzuSDOWzrCDEeJBwe6MyctqVOgBWhgchDLe/ 8AwzVGbeDyjzyk/jlwc0WiHSVDh7ukJiqJVZpoTiRrskIOSgxxvXNk8FbJe7h X-Received: by 2002:a1c:2802:: with SMTP id o2mr11912069wmo.170.1621435816108; Wed, 19 May 2021 07:50:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzExqQtkXDb+lj+03vZaMs1NTWf1irqt+Pmv5JH54/F+aNXZlT2XWkOY11D/CbrLbTwJGBEkw== X-Received: by 2002:a1c:2802:: with SMTP id o2mr11912037wmo.170.1621435815874; Wed, 19 May 2021 07:50:15 -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 k11sm6021496wmj.1.2021.05.19.07.50.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 May 2021 07:50:15 -0700 (PDT) From: Aaron Tomlin To: linux-mm@kvack.org Cc: akpm@linux-foundation.org, vbabka@suse.cz, mhocko@suse.com, linux-kernel@vger.kernel.org Subject: [PATCH] mm/page_alloc: bail out on fatal signal during reclaim/compaction retry attempt Date: Wed, 19 May 2021 15:50:14 +0100 Message-Id: <20210519145014.3220164-1-atomlin@redhat.com> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210519130609.r3ml6ohb2qsrfq2t@ava.usersys.com> References: <20210519130609.r3ml6ohb2qsrfq2t@ava.usersys.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b="dhk/9T6r"; dmarc=pass (policy=none) header.from=redhat.com; spf=none (imf18.hostedemail.com: domain of atomlin@redhat.com has no SPF policy when checking 216.205.24.124) smtp.mailfrom=atomlin@redhat.com X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 684CD20007EF X-Stat-Signature: wrm3ap9tnd9z987168s9wkuka7a7ieo5 X-HE-Tag: 1621435819-652103 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000017, 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 the last known compact result was skipped and 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 when the last known compaction result was skipped and 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 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index aaa1655cf682..5f9aac27a1b5 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -4268,6 +4268,8 @@ should_compact_retry(struct alloc_context *ac, int order, int alloc_flags, * to work with, so we retry only if it looks like reclaim can help. */ if (compaction_needs_reclaim(compact_result)) { + if (fatal_signal_pending(current)) + goto out; ret = compaction_zonelist_suitable(ac, order, alloc_flags); goto out; }