From patchwork Tue Apr 18 19:13:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Weiner X-Patchwork-Id: 13216103 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 66BEAC77B75 for ; Tue, 18 Apr 2023 19:13:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AE3D1280006; Tue, 18 Apr 2023 15:13:39 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A92C1280001; Tue, 18 Apr 2023 15:13:39 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 933E4280006; Tue, 18 Apr 2023 15:13:39 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 7F673280001 for ; Tue, 18 Apr 2023 15:13:39 -0400 (EDT) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 597D616045A for ; Tue, 18 Apr 2023 19:13:39 +0000 (UTC) X-FDA: 80695460958.30.6CDEEEC Received: from mail-qv1-f41.google.com (mail-qv1-f41.google.com [209.85.219.41]) by imf26.hostedemail.com (Postfix) with ESMTP id 9FD39140013 for ; Tue, 18 Apr 2023 19:13:37 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=cmpxchg-org.20221208.gappssmtp.com header.s=20221208 header.b=aeYONsgP; spf=pass (imf26.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.219.41 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=1681845217; 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=oyoKJQkIW9YTYt09kObRpzKT5MnW6BvwQNuIxs7T4Tc=; b=CgJpFYCjz8q5Hb3iuzli7W2LZDuJZpkW6L4Y87mxl58X/y57+JpwdutDK6Klg9svX7d1Tb zAdZIcFCXg7MG2+OPk0z0n0Vl1LtdLcjSH0NV+T1tJgo8eJyWnHqtJGxDXUB4cC2Wt1pqD eYe53NuR4zCZqMiyYeNvkYQatuWg2NY= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=cmpxchg-org.20221208.gappssmtp.com header.s=20221208 header.b=aeYONsgP; spf=pass (imf26.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.219.41 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=1681845217; a=rsa-sha256; cv=none; b=hIVrxDWu4riDlIO0DvmxwXBYrGdks3tVC/KUoaqcvXiZ6N8m6oui6ujpB+C7G+WX9n6xaC m/rbxxEBQrN5zJQWaBsKMo/nfOUvSuM2/Li7Bv8rm/JMsOMPOEHUbQ2vJ/JcVAsE85Sc4N /aVYTX20zCuSANGcgw7NUY6lS9aO0do= Received: by mail-qv1-f41.google.com with SMTP id op30so18259250qvb.3 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=Xlc08MX0KZyXeTKoXsJBXk3TLvUB8TE5VS/UCMgavrEF5SXPNCBkpHuhfyeo0h222S IKDmbqJirEp8nhAFCopTeEaIQqdxsyv6LXAqhS/tVibtPj8KZkP83tlrcArMVGBvE2Lq wxkwucwXEJ/Os7/+LrQnnOrJHZfZs9thEu0hHSN2P0TTK1NWxdSA9Sz2I/FejawptlSx uuLkqq3LmxRE/mynjcfiV2OG9u+OKzEci+53wPOqYDIPrDBadUXP39B9Tuo41DdfHs73 KY/HuMOEFE/hRI9ltSBarKTqV4ZcgU/ojN2RJBjl2puW4nWSu8YeLzcUNbFluDBy1ZO/ FAhA== X-Gm-Message-State: AAQBX9da6cmR9thv+p7h90NINRqSXjEY75s7/RowHNLWRDAGtblQgIOH V978wzP6nfRgmzZH6pLMvxR3ZWS67nwhRtZwRP0= X-Google-Smtp-Source: AKy350awQ/PRfC/BhFkVKh85YOny0ld5DKS6bQHcNwzqu22Ols+1ZFQkDT9bbDkAlKwae5T6XGpjKg== 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 X-Rspam-User: X-Rspamd-Server: rspam03 X-Stat-Signature: sjgg4rme1ge9n5bj7bohysx1ki4wjipp X-Rspamd-Queue-Id: 9FD39140013 X-HE-Tag: 1681845217-452554 X-HE-Meta: U2FsdGVkX1+jQMLy/E8ZPLVi2dbx0jG95EtVCk4qNMv6F1CXDn2EDwtTC5JhxZg4hRAf7O4EhMg01oX4pgskfITr5DM4/riGoLYniboLvosRn7uuFsJ6Ug2bH1N1YRE0SSrOrlO0eWYUfKyjBA/g8SWNq3D9E9s6maUI6DixxGt/SPnDb4/p+fgN4degWoqG9oICDkJtAM94LXn03rLTN6jBtciqkSLDpl73E0nYYo6pXEBEkeuLM+uyRCJ9CKFcL6XPFULVf5fzIefDDROXRJdpyye1noSWgg5kUjNbCU9s4Lw1I21ho46FrMex02lOVFO5sUERNy1e/UEy3hUd8XHUMutYmQANkILUzmaPuFzZ/Z4kNOVsFpSt6kI23yxoek033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T9cYoG9syn3C3vypGvf2dS7HHsJL8680KB/gdo0G66P8S+KQ== 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: 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 */