From patchwork Wed May 19 19:23:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aaron Tomlin X-Patchwork-Id: 12268329 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 45728C433B4 for ; Wed, 19 May 2021 19:23:28 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id BB2FD6108D for ; Wed, 19 May 2021 19:23:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BB2FD6108D 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 38CAD6B0036; Wed, 19 May 2021 15:23:27 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 33A7F6B006E; Wed, 19 May 2021 15:23:27 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1DBAC6B0070; Wed, 19 May 2021 15:23:27 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0146.hostedemail.com [216.40.44.146]) by kanga.kvack.org (Postfix) with ESMTP id E10166B0036 for ; Wed, 19 May 2021 15:23:26 -0400 (EDT) Received: from smtpin36.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 6DCA9181AF5D0 for ; Wed, 19 May 2021 19:23:26 +0000 (UTC) X-FDA: 78158954412.36.059D440 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by imf23.hostedemail.com (Postfix) with ESMTP id 03DADA0003A7 for ; Wed, 19 May 2021 19:23:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1621452205; 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; bh=3WjHLe7Vud9dDJn40LFvnZRilRoTHkcFzpqQq2wlvq4=; b=BGNHKKOT6vVoheVPmUZ6mfMTxmIK2kO2yfIherjUadLDgmI780rKO6VMiIG/KN5EzZ3V7c 9x0PhHwzzOBWyCyjVDkAsXIQ6cgIfS8FaK4GcMUj+r0qi3dQic3ghl1Ck0cXFAYyCHr2Vy PJM9Br39rngOzLRZI2k1B16HeTxLsYg= 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-33-swTWixgZOF-VfuUeaPLuUw-1; Wed, 19 May 2021 15:23:23 -0400 X-MC-Unique: swTWixgZOF-VfuUeaPLuUw-1 Received: by mail-wr1-f69.google.com with SMTP id a5-20020a5d6ca50000b029011035a261adso7538997wra.17 for ; Wed, 19 May 2021 12:23:23 -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:mime-version :content-transfer-encoding; bh=3WjHLe7Vud9dDJn40LFvnZRilRoTHkcFzpqQq2wlvq4=; b=Juy7yqzAoIeP+JXB2CZDaAPOJZStBY9ey2p/LVmOedfsf8E0Ax6qn6SCigB5RNOyI2 vc5YydyPm+f/ZV4zYGwMNCYBqOAdgxS8WLGHEUr/fg8ykgGqU61fcQt05ovyB0VDeOlh pd1zwRsB0E82V/zKGhHSyQunCcVt4lLvglSD2B+M61q/qkk1F0RXO7Uz1FrIcEnllR7G w813ulDk+mBwXD0rRVP99CY2NwISy/tu0ZvzLRz0iWoAz2F2O9ytGAvIm9mPKfrFJ61J JyooljaW4dJjiZ9jvtusbbKYJDXMuE0Uzmp0w8PJAp8xPSjtJRAOEhu/zWhbz5JOVE82 nYBA== X-Gm-Message-State: AOAM532vRbu6G+IG5Tr8sLtR/CQqNnGfIGRZo2dwg39VmkTWV2FS873C deAb/YwVw419Y/TtUm/LnpYXS3HONg2a7Qm97xeKbGevnkC4eBBRle7uj7iPSfcLUzZpnKipAc+ vFFyCBkOfHwfAxmLFmFYZSLMlfCD5nbOsSOM9nuXTq+FNIm+ak0dJuFUEqWeD X-Received: by 2002:a5d:688c:: with SMTP id h12mr520972wru.348.1621452202284; Wed, 19 May 2021 12:23:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJym03hDmbID+lz+UjdMn7Xm8C/IopBXH7nwK38fTok52P/RFMMQ5K8a86YxCSqStlXtpXeTsw== X-Received: by 2002:a5d:688c:: with SMTP id h12mr520952wru.348.1621452202051; Wed, 19 May 2021 12:23:22 -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 k6sm6664098wmi.42.2021.05.19.12.23.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 May 2021 12:23:21 -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 v2] mm/page_alloc: bail out on fatal signal during reclaim/compaction retry attempt Date: Wed, 19 May 2021 20:23:21 +0100 Message-Id: <20210519192321.3247175-1-atomlin@redhat.com> X-Mailer: git-send-email 2.26.3 MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Rspamd-Queue-Id: 03DADA0003A7 Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=BGNHKKOT; spf=none (imf23.hostedemail.com: domain of atomlin@redhat.com has no SPF policy when checking 216.205.24.124) smtp.mailfrom=atomlin@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-Rspamd-Server: rspam04 X-Stat-Signature: j617786s4sa8838wohnxttkqneuxyxo6 X-HE-Tag: 1621452204-491328 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000002, 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..49f416ffb54f 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)) + goto out; + if (compaction_made_progress(compact_result)) (*compaction_retries)++;