From patchwork Tue Apr 18 19:13:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Weiner X-Patchwork-Id: 13216106 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 C3FB5C77B78 for ; Tue, 18 Apr 2023 19:13:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7AEA590000B; Tue, 18 Apr 2023 15:13:43 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7377F900009; Tue, 18 Apr 2023 15:13:43 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5D7DA90000B; Tue, 18 Apr 2023 15:13:43 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 435E3900009 for ; Tue, 18 Apr 2023 15:13:43 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 1D35216045E for ; Tue, 18 Apr 2023 19:13:43 +0000 (UTC) X-FDA: 80695461126.19.0D358D5 Received: from mail-qt1-f175.google.com (mail-qt1-f175.google.com [209.85.160.175]) by imf20.hostedemail.com (Postfix) with ESMTP id 550A21C0012 for ; Tue, 18 Apr 2023 19:13:41 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=cmpxchg-org.20221208.gappssmtp.com header.s=20221208 header.b=NAETWyAR; dmarc=pass (policy=none) header.from=cmpxchg.org; spf=pass (imf20.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.160.175 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1681845221; 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=35b4U2+QOBa6ocJ8iDrcqYLn7rCBrGVWRfOUb6rO6cw=; b=ltbHf9F1Ogr+N1s7xxqm0Yv/TKlfnXzT8mghg7v087YfwJM5CjdI2Cfh75tYVE9zMuLI4H gILJqdJHu2o1DYBT4flJD7MQxD8oDyKPzGGn3yctnG77MIABiKCtTfhIZujFFsVbwkRfYn D4uqkOB8gNWfC2MvqLOkdb8qTMK03zM= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=cmpxchg-org.20221208.gappssmtp.com header.s=20221208 header.b=NAETWyAR; dmarc=pass (policy=none) header.from=cmpxchg.org; spf=pass (imf20.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.160.175 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1681845221; a=rsa-sha256; cv=none; b=bc0I8Ec3Bkq/LK/l3TXIZiQekpTqc+1IOAYknHpuHlzIzmxG+xg2kokSPJEjfdOJqXaI/B Z0QyUggkEZ0z4WvaxxCPoFgLy9KQz5wMSYytLpzRrqrtvhB0aZtEe+RbccysG9wGEqE3Ig X9ojXI0kCdTg455vQ0tmgzHtBNEnDX0= Received: by mail-qt1-f175.google.com with SMTP id fv6so16946543qtb.9 for ; Tue, 18 Apr 2023 12:13:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20221208.gappssmtp.com; s=20221208; t=1681845220; x=1684437220; 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=35b4U2+QOBa6ocJ8iDrcqYLn7rCBrGVWRfOUb6rO6cw=; b=NAETWyARHURXPOi9rz+E7BtKwnN/WCnP/+JO7LpCEDD8Yt6Nwt9wWNaKjVbRvN3xz2 CI34kcfshgq+HARendk3lJbfoBE5MkvdQWSrlrPBJRjmqsIYk3kDyWnUU7Frq+txzTlS H4HITpALdNoddu4n6BLDIclxULAYQC3G62W5TzlCuce+rhSeoOwKcEgfrWQxqneeYLbo 7wKg/+icg/zDzq1yq49DPPPiRs66pUC5NSRrssu+vBTZ4mZZ9Ce9QCpZuahqpc5imLz3 XtNWiOATBaotDlzMFP51F9IOzwQmK3bigZcA6HkmSjex3STf6qkddtjV7o1GG3sIRsXg ppGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681845220; x=1684437220; 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=35b4U2+QOBa6ocJ8iDrcqYLn7rCBrGVWRfOUb6rO6cw=; b=RmjdwUHTYXdBbAdOqrzFXqssKieUrB9blRCXwgKvi6zqwy62HC2vv5Ypb6bw2tVjto QN6sOZwmOVFOXTqnagE6ME5NvpjICjyCX/77quKSOKin+Pti18MofKmmnaP++hY4pAA1 mrBx9TeTgy2717qEOLyUuDC6HDCJA29tnGlh6DAZh/9cFV1A/vqN88U5dt/nSPyIPeFn WW/6SlTwUpUbYIfCkG0C591mzAdCjxjHq/l9zPsgsYSWhkSkJnbvh4L+VzfSp7V40v+Y TlMfcDCcSOeFmTwhE/2sPjJImPJsztOVMXQYtLOlMsoX73Q6tvMDrIiv8u/wo7+RWrL6 p0WQ== X-Gm-Message-State: AAQBX9cvOD/37g+v1hs8tSGOef3QXfJj3oJ6irUhavnkGXHYObkOJbdL 3pKVbTPHXQoD7Z42jcwabRBuW/ngQmwWm767x4A= X-Google-Smtp-Source: AKy350Y9D95GmbNdWa9qjbsQ3a5RYAukR0KDWI7MiGw1X4tAzUYurG+5JZjzgpO5fAjmLVD2oLXHwg== X-Received: by 2002:ac8:7fd6:0:b0:3bd:1081:b939 with SMTP id b22-20020ac87fd6000000b003bd1081b939mr2038244qtk.0.1681845220210; Tue, 18 Apr 2023 12:13:40 -0700 (PDT) Received: from localhost ([2620:10d:c091:400::5:e646]) by smtp.gmail.com with ESMTPSA id d14-20020a37680e000000b0074d1b6a8187sm2482147qkc.130.2023.04.18.12.13.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Apr 2023 12:13:39 -0700 (PDT) From: Johannes Weiner To: linux-mm@kvack.org Cc: Kaiyang Zhao , Mel Gorman , Vlastimil Babka , David Rientjes , linux-kernel@vger.kernel.org, kernel-team@fb.com Subject: [RFC PATCH 18/26] mm: compaction: remove unnecessary is_via_compact_memory() checks Date: Tue, 18 Apr 2023 15:13:05 -0400 Message-Id: <20230418191313.268131-19-hannes@cmpxchg.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230418191313.268131-1-hannes@cmpxchg.org> References: <20230418191313.268131-1-hannes@cmpxchg.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: 550A21C0012 X-Rspamd-Server: rspam09 X-Rspam-User: X-Stat-Signature: emmca1dfqkrwa87tcqqn7o7ss5jwxyum X-HE-Tag: 1681845221-321991 X-HE-Meta: U2FsdGVkX197YaftonD0D6WUH+xcuIjyMl27YjYCdd36ZW7R8uZs5oCuVRbwKz0q3L9I9lOmVGsZWzwv4BTdOuDx0Vq6NLEVhY+2BK5u+njTe8KD7M6B71OxA35baMKyAxTLWpuK0p7TM2YaMgmLxQJ12CUSTlb5L91UICVsNSiuoTpxpDG1VTxZmv4dlaFEeRK/mgh/NV4Qd+xa7spc9uW64isnBcCUdrl9+zbVARaxlxgEr/8LhkRNa2WgdGWPK3aVlOL+V6t/cLhSqx/6lRaLRfzndZFuc2hLkl3MF+73T3tHZurVyRJSgfDSKLaloG1shOkpbzgzu6XWbDOEDtOdorFF2zUEB8bI/s7p4N97jVTFuojPx1RyNxchv96l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yEA3XFCAFqFJA1jL5auiLo+xvYsCZHF1it8+iyyORiAySXXape6zJisnBhQKBiHasBjqYsokL 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 --- 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 d4b7d5b36600..0aa2a0a192dc 100644 --- a/mm/compaction.c +++ b/mm/compaction.c @@ -2265,9 +2265,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, @@ -2808,9 +2805,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), @@ -2855,9 +2849,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)) @@ -2866,7 +2857,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 a0ebdbf3efcf..ee8c8ca2e7b5 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -6076,9 +6076,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)) @@ -6275,9 +6272,6 @@ static inline bool compaction_ready(struct zone *zone, struct scan_control *sc) unsigned long watermark; unsigned long free_pages; - 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)) @@ -6287,7 +6281,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