From patchwork Fri May 19 12:39:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Weiner X-Patchwork-Id: 13248286 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id A2C8FC77B7A for ; Fri, 19 May 2023 12:40:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B624B900009; Fri, 19 May 2023 08:40:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B1390900003; Fri, 19 May 2023 08:40:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 93D68900009; Fri, 19 May 2023 08:40:14 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 7E9BB900003 for ; Fri, 19 May 2023 08:40:14 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 508871409B5 for ; Fri, 19 May 2023 12:40:14 +0000 (UTC) X-FDA: 80806962348.12.CE3545D Received: from mail-ej1-f43.google.com (mail-ej1-f43.google.com [209.85.218.43]) by imf13.hostedemail.com (Postfix) with ESMTP id 510822000F for ; Fri, 19 May 2023 12:40:12 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=cmpxchg-org.20221208.gappssmtp.com header.s=20221208 header.b=GT59zzmh; spf=pass (imf13.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.218.43 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org; dmarc=pass (policy=none) header.from=cmpxchg.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1684500012; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=I12hzcEozsRt6JPAOpJEFjq1ISq2RgZIT2QaHAH/cww=; b=8Qpog6FnwzbU9E+3KJs8IO2bVybvX2OtjAluSMoMzeZjFQOX5LTmvyln8SPj0whfipgQAP Ns892qpRiKvJs/EwuHs9UonicV5v/qtgO0bp4MdUWRiypMRyZnYjUyO4spxNPqan2r/0Nt 7j72FUTia7azpD72shvZJMrT7/ShxAA= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=cmpxchg-org.20221208.gappssmtp.com header.s=20221208 header.b=GT59zzmh; spf=pass (imf13.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.218.43 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org; dmarc=pass (policy=none) header.from=cmpxchg.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1684500012; a=rsa-sha256; cv=none; b=hciJ3t65c6Pn8mdo+ho04wBJXwqYm9TSWOUd5bbAy1vUkpog7vbZkYgmfGdeXZGuboCIfj 98A0lHITgTuxD4arO3OAamngqd/iYq0b0wAHRLYy0ydKRHqQOc/yVRHOdxG1Iv2X1WSDdu +zFBgonvNh7zhi+XHJrFp8jVvAFIsnw= Received: by mail-ej1-f43.google.com with SMTP id a640c23a62f3a-94a342f7c4cso610445766b.0 for ; Fri, 19 May 2023 05:40:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20221208.gappssmtp.com; s=20221208; t=1684500011; x=1687092011; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=I12hzcEozsRt6JPAOpJEFjq1ISq2RgZIT2QaHAH/cww=; b=GT59zzmhCzWRze5Mlw1ALcSFM9y1f9VU/vsZANEVBYHqrlCkXWWh82A+SSfKkAhcf4 3tQ4UFzmxgxZ15dHaxAEnORekxc5TClUeKGWjmM3kIdHBVyDw4ORdXKtk4UyFNmyLKsx bPrrt63f3L9CI/VluEvxZgTjbObARXFRQrS6O0wUVIlJvsvAh4EhyRGdH/5mzFfSMvAU Ma2idKjNNvoYRHFytUI0nQaXf6rj3SDgQr9NpgZmmj7Yk6zkusJ3ACinYJ0FWUKgb/PF jUETXeREzOwQbPb+s4QGvIlHS2Hg954aU5qGVb5Th2SArEQNshM7l3a3RdF3R0fs+NVo k1Ag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684500011; x=1687092011; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=I12hzcEozsRt6JPAOpJEFjq1ISq2RgZIT2QaHAH/cww=; b=WD7Gilza07g7tiY1siR/j0RkLpgH1RZdmx1k5iQDGEYCi7nV/MvUrjTnoh5gx/7H7/ xkHbi8HhjsL/sm9K0z6ETE36nxCiqVt6Lr3Tp3RgBe0hzYPKHRgGHzX8nmC91R94royy McXh7Egkje7YzVIH7JL+OEQf8JZ+dn2Kh7wDhakg6O+BmMNma/rkLRFsXJw7ZwJiyfJ2 M9PsrwqZUMMAuwuq4OjSJkgt0Gn1dSu3wzlg1yjGwevJAVWXtZZpbRwy07ajl6zz5Jmo bIHR5DIEbRF/O6b0ofcy/aEmlm6LNArjphga6dScVGIhzXOZVV0SZkUTUOFFCo3fmztJ cW2Q== X-Gm-Message-State: AC+VfDzIBgcZFuZeo0c5kWcw5++jgFSxAFiIaaqYak8uu9Zb0QVcSOnU srgceHDinEVr65KgQWZAGNXTbQ== X-Google-Smtp-Source: ACHHUZ4u90+qy6wcMhun2oAgrbOIc2XjLRHqEiy1bSQkvwbZrSERksL8jCVIYbiTqqILkLPHJwuusA== X-Received: by 2002:a17:907:5c7:b0:96a:ed6e:7d58 with SMTP id wg7-20020a17090705c700b0096aed6e7d58mr1561004ejb.7.1684500010821; Fri, 19 May 2023 05:40:10 -0700 (PDT) Received: from localhost ([2a02:8070:6389:7d40:e266:3092:9afb:a7b1]) by smtp.gmail.com with ESMTPSA id q26-20020a170906145a00b00966069b78absm2236221ejc.192.2023.05.19.05.40.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 May 2023 05:40:10 -0700 (PDT) From: Johannes Weiner To: Andrew Morton Cc: Mel Gorman , Vlastimil Babka , Michal Hocko , linux-mm@kvack.org, linux-kernel@vger.kernel.org, kernel-team@fb.com Subject: [PATCH 4/5] mm: compaction: remove unnecessary is_via_compact_memory() checks Date: Fri, 19 May 2023 14:39:58 +0200 Message-Id: <20230519123959.77335-5-hannes@cmpxchg.org> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230519123959.77335-1-hannes@cmpxchg.org> References: <20230519123959.77335-1-hannes@cmpxchg.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: 510822000F X-Rspam-User: X-Stat-Signature: 9enbmey94sry9dkip5dmox858aiogkbk X-Rspamd-Server: rspam01 X-HE-Tag: 1684500012-220759 X-HE-Meta: U2FsdGVkX183f04ztqcrjl21pyW9/24Co0Hv2To/dirqVLbJEx7nAA76wEur2/X1U9mXhnvP5akhEu3lgGmGYh+oy1ATREjRysOcnzLjfbjLgwPZhOfkWX4qOZKGM+/pPXMlUGssbynJV9Kki6TtmtMt1/KzGkVvHyLKiAWCZYMoVtDNxFDjMzLBr4DxzGFxTXTz5u7Ew5huRugghydiTCG9kD//WTCDLzzsyrEDxMgw2bTo8NEPXf/eG29WI5KhCEirzwaMypSjD+gGOL60z3okmXZopWmlnWWfGME9Tsy3Ci4Et7JOXbvm7Eaim/HlO+ADqerQLzzXDh9l28yQuJALuRR7ZTBGat72LSTqvnYCCHEO+jbYdjfrnTVf2bNjzCE6LINhzK4rKarzcIGLTpd89Dr0/Nr5D6Y6b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yLq+rFJFRt0ku0eqv7jEHNHTjUQKGw03CXPc0zL+C6t6iKXaxHkA== 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: Remove from all paths not reachable via /proc/sys/vm/compact_memory. Signed-off-by: Johannes Weiner Acked-by: Vlastimil Babka --- mm/compaction.c | 11 +---------- mm/vmscan.c | 8 +------- 2 files changed, 2 insertions(+), 17 deletions(-) diff --git a/mm/compaction.c b/mm/compaction.c index 8f61cfa87c49..83ecbc829c62 100644 --- a/mm/compaction.c +++ b/mm/compaction.c @@ -2293,9 +2293,6 @@ bool compaction_zonelist_suitable(struct alloc_context *ac, int order, unsigned long available; unsigned long watermark; - if (is_via_compact_memory(order)) - return true; - /* Allocation can already succeed, nothing to do */ watermark = wmark_pages(zone, alloc_flags & ALLOC_WMARK_MASK); if (zone_watermark_ok(zone, order, watermark, @@ -2850,9 +2847,6 @@ static bool kcompactd_node_suitable(pg_data_t *pgdat) if (!populated_zone(zone)) continue; - if (is_via_compact_memory(pgdat->kcompactd_max_order)) - return true; - /* Allocation can already succeed, check other zones */ if (zone_watermark_ok(zone, pgdat->kcompactd_max_order, min_wmark_pages(zone), @@ -2897,9 +2891,6 @@ static void kcompactd_do_work(pg_data_t *pgdat) if (compaction_deferred(zone, cc.order)) continue; - if (is_via_compact_memory(cc.order)) - goto compact; - /* Allocation can already succeed, nothing to do */ if (zone_watermark_ok(zone, cc.order, min_wmark_pages(zone), zoneid, 0)) @@ -2908,7 +2899,7 @@ static void kcompactd_do_work(pg_data_t *pgdat) if (compaction_suitable(zone, cc.order, zoneid) != COMPACT_CONTINUE) continue; -compact: + if (kthread_should_stop()) return; diff --git a/mm/vmscan.c b/mm/vmscan.c index c9c0f3e081f5..c0cfa9b86b48 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -6397,9 +6397,6 @@ static inline bool should_continue_reclaim(struct pglist_data *pgdat, if (!managed_zone(zone)) continue; - if (sc->order == -1) /* is_via_compact_memory() */ - return false; - /* Allocation can already succeed, nothing to do */ if (zone_watermark_ok(zone, sc->order, min_wmark_pages(zone), sc->reclaim_idx, 0)) @@ -6596,9 +6593,6 @@ static inline bool compaction_ready(struct zone *zone, struct scan_control *sc) { unsigned long watermark; - if (sc->order == -1) /* is_via_compact_memory() */ - goto suitable; - /* Allocation can already succeed, nothing to do */ if (zone_watermark_ok(zone, sc->order, min_wmark_pages(zone), sc->reclaim_idx, 0)) @@ -6608,7 +6602,7 @@ static inline bool compaction_ready(struct zone *zone, struct scan_control *sc) if (compaction_suitable(zone, sc->order, sc->reclaim_idx) == COMPACT_SKIPPED) return false; -suitable: + /* * Compaction is already possible, but it takes time to run and there * are potentially other callers using the pages just freed. So proceed