Received: by 2002:a05:6358:53a8:b0:117:f937:c515 with SMTP id z40csp5836048rwe; Tue, 18 Apr 2023 12:16:18 -0700 (PDT) X-Google-Smtp-Source: AKy350ZKFnn1pllDqcwmBxTNyCGglhbQeAoQKwH4yhP7iLHTjxZUJnTxgGys4PW/D1F9J4qIGG6l X-Received: by 2002:a05:6a21:599:b0:f0:1878:23b0 with SMTP id lw25-20020a056a21059900b000f0187823b0mr583138pzb.51.1681845378106; Tue, 18 Apr 2023 12:16:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681845378; cv=none; d=google.com; s=arc-20160816; b=wa/An1Kc/39fQW3bQe+VfV7eg6RVIebB2TvMCZ3GOL9oFII9sEY1Dmoo9h5iRAwScL R3j4O3rMmrURZ8GKzR2F9RrJNKxQd4tpfvsIxJr9xI1O2oxDIhvgHvL+0LkRKhl27rQd f7gDOwnd2cglahcFLyd1Oo/dQKZJ4nKb8GiWrfbfTKe3WGnhsnNcFpU5BAXWZtlaMaEp +GiNRRW8x5xt4OiShJVh93Tc9Etq5MpAWSvAjF9Rh7eo7rFlOkNI53lHurmXwW4WCpzp 0WtJZsNhf8HgjO1cyWSUSezbLwLEsRyrlHK7wlSAxQPJ6a/P29bWc0KKuC3VFLik7Kbz JpeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=oyoKJQkIW9YTYt09kObRpzKT5MnW6BvwQNuIxs7T4Tc=; b=YExmORhB8gZko4PbeB1/mOEUcBuMZAc+qUo61CsCv0dB5R2ePBVM8ZzygtZx+8T10H v4dd6U2LbtqI+sB0tF05SRDmMh9SvQXyHOMUiZpdJm1s88dh1Bk6qszFgrYm5aqagkhy a+NvqvlRv3XTWGoL5zfWBRgX2c2Mm7A81w8StyGCGUZcdkb/GFewUdebrOGSAS5f6ZcO CDVXqVRVUjEm46pWLSlIMM418PN8sZnY4zOSG7Au9Fszw5mlWUpRMLZPrc/Vmi07+KeA GUyCHw7Yx6epi5No0xQM54PaNsFTTPwYC2OUeoiHjz7Im+7YToSJ/xH3VeWh/ztcVPTT rgqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cmpxchg-org.20221208.gappssmtp.com header.s=20221208 header.b=aeYONsgP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s1-20020a63dc01000000b0051b614be920si13698272pgg.498.2023.04.18.12.16.05; Tue, 18 Apr 2023 12:16:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@cmpxchg-org.20221208.gappssmtp.com header.s=20221208 header.b=aeYONsgP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232849AbjDRTOo (ORCPT + 99 others); Tue, 18 Apr 2023 15:14:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57838 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232865AbjDRTOE (ORCPT ); Tue, 18 Apr 2023 15:14:04 -0400 Received: from mail-qv1-xf2e.google.com (mail-qv1-xf2e.google.com [IPv6:2607:f8b0:4864:20::f2e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 55E4EAF26 for ; Tue, 18 Apr 2023 12:13:37 -0700 (PDT) Received: by mail-qv1-xf2e.google.com with SMTP id js7so10390143qvb.5 for ; Tue, 18 Apr 2023 12:13:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20221208.gappssmtp.com; s=20221208; t=1681845216; x=1684437216; 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=oyoKJQkIW9YTYt09kObRpzKT5MnW6BvwQNuIxs7T4Tc=; b=aeYONsgPSzQQgWyb5FHu2pLc4enHXJiXdaQ/URnHTI4N+Nq62uPdJYSr8YJxsZo7DW gB6lifiemln0yXBoUpetZdAa+m3U7Murk1q9y6eEqAxekRgWZCiGw2kWjYInRjtT3eFT DkRD7r1ECPLst/vkbKvyzSRNiHJuj9OxC47RNcVmUl1WWTCQ+sn8Jx5NKLfVkdObtBW0 S8SXnhzF5QsXyMf5O/UpkE9MPOzstc3gDLc3FhYxPAPxbgDfog2ZjfNGJa31r+oOo2GA REeMAyuiQFEJZ21mYaqXnYQUFwEa8R+Jwrb338SotrhcoLFx+tzMMjRnzYViLbYZJo1o t/mQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681845216; x=1684437216; 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=oyoKJQkIW9YTYt09kObRpzKT5MnW6BvwQNuIxs7T4Tc=; b=gSxzYP80a+LKVPfxNmf+/4LwXi4BvH2v4EaT0q+vNBWgK+jt7DuqXvxGTktq+rl78A 8mzf0E7VNMAzGZ4gYfctYHrxlU/kxy1lVaniRkSTC6vuDGXf9JYcYbKB/cRWKy/IEpHY 53WBPhAzR9QPU6NmZycmYot5hNTVAi9kbKfiUDb3RE5spWbkm/30v0D65f9SFa6pgEXD Pm28fraKzJoHJYsWB9aLNHEa0lPgU9jJceJQ/RjY2C24yIB01y+jQw8c1gB2PrCWQtVr JGsrarAaJf8Z6ObrPeqgE2O6eus6pBZmPy8xFN3aR/hIgHXSEjP7JQlMGQbq2smwiC8z O+9g== X-Gm-Message-State: AAQBX9ffRI7ST9aEfQD4Pb7qAdmlTKPmeNUtQ1tmKGQEQltc15NR3VZK WCsMujkOPdgUbKYXy/lIqS21LBegX80+pH/k2G8= X-Received: by 2002:ad4:5762:0:b0:5ef:739a:1c46 with SMTP id r2-20020ad45762000000b005ef739a1c46mr16977002qvx.1.1681845216529; Tue, 18 Apr 2023 12:13:36 -0700 (PDT) Received: from localhost ([2620:10d:c091:400::5:e646]) by smtp.gmail.com with ESMTPSA id kr24-20020a0562142b9800b005eee320b5d7sm3844283qvb.63.2023.04.18.12.13.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Apr 2023 12:13:36 -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 15/26] mm: compaction: simplify free block check in suitable_migration_target() Date: Tue, 18 Apr 2023 15:13:02 -0400 Message-Id: <20230418191313.268131-16-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 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Free page blocks are now marked MIGRATE_FREE. Consult that directly. Signed-off-by: Johannes Weiner --- mm/compaction.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/mm/compaction.c b/mm/compaction.c index a2280001eea3..b9eed0d43403 100644 --- a/mm/compaction.c +++ b/mm/compaction.c @@ -1281,22 +1281,17 @@ static bool suitable_migration_source(struct compact_control *cc, static bool suitable_migration_target(struct compact_control *cc, struct page *page) { + int mt = get_pageblock_migratetype(page); + /* If the page is a large free page, then disallow migration */ - if (PageBuddy(page)) { - /* - * We are checking page_order without zone->lock taken. But - * the only small danger is that we skip a potentially suitable - * pageblock, so it's not worth to check order for valid range. - */ - if (buddy_order_unsafe(page) >= pageblock_order) - return false; - } + if (mt == MIGRATE_FREE) + return false; if (cc->ignore_block_suitable) return true; /* If the block is MIGRATE_MOVABLE or MIGRATE_CMA, allow migration */ - if (is_migrate_movable(get_pageblock_migratetype(page))) + if (is_migrate_movable(mt)) return true; /* Otherwise skip the block */ -- 2.39.2