From patchwork Wed Aug 2 09:53:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 129734 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f41:0:b0:3e4:2afc:c1 with SMTP id v1csp338990vqx; Wed, 2 Aug 2023 02:59:35 -0700 (PDT) X-Google-Smtp-Source: APBJJlECNrm128oL0JYenfYwUsVgVJGcPoiMtwNr9QG6NerziIOrVXaQlxO5dVX+nwS+oQKMNpqH X-Received: by 2002:a05:6a20:8e0f:b0:126:42ce:bd44 with SMTP id y15-20020a056a208e0f00b0012642cebd44mr18129364pzj.17.1690970374732; Wed, 02 Aug 2023 02:59:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690970374; cv=none; d=google.com; s=arc-20160816; b=TdopTeALDW7SON/0C2CqhUTrfAolIxvT/w0XmDVf5y1NAZo0HM7GKG5bR3EF1Em7W3 l6a7/tWLYMDDgzUDV51QmDzylObrW/Lt1Sg0xbL8eQIb+QB+KGaCju8+rsysYhPKZp5r QMKDRf/YczdAN7b7pNRRPQAk3YNMB7dkJ+YxFHJetk7DeALAUMtglagsv/tQXgUWuX3i WlQW19tPYFuRRZoHwosirRUsuzSTcFsGD7wBqzBnXfnUrwOgaVu8zXBZj0HIdVcBImXE GZI+IecRttzLs8q1147zsEGqMxdP3mv6xU3wgBN5/AiexCfciq13x601CQCvNy8dERlT M3fQ== 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; bh=C9SLzI1jBQxZ3MenzIaKU+m294r5B3MM6jSUBENnZOM=; fh=frTJ5b0OruHscvMLDfKfibXYJSJ4/6aFlw/4ZMUelj0=; b=wcN7pez2ciFc3N96TXMdkn3PGddfswoEzBymTgr8QhbtcHKOsLXZFjV0PG4qbrbp5n IUFpD+R/6LmQtui8LIIqbMf7jbEKALKLptvYso4xdKGK1xc/tZPrQwxSzuWoszbcFVvy Ywd7VEBFJbLPfGBgLbduRbmMkKQ/NdSzp6rMK7M1r1o5KGA5YoAHBUa7oPkKXf8Bo3sh 62ZCILSStWozu5dvsNsvDXlTSoRaWPZc8O8n/gwJmwwcvDCaOfqTw1tOuV3JSE6QZe13 /fak2OHQ/FbfeKN9Nux79qghdTAfRf2IjRGmHLTDBiWCtJOgxjv4n7FRfqRxv3qe4cv2 Gdjw== ARC-Authentication-Results: i=1; mx.google.com; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m27-20020a63711b000000b00564364d198fsi6262370pgc.361.2023.08.02.02.59.21; Wed, 02 Aug 2023 02:59:34 -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; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229948AbjHBJpo (ORCPT + 99 others); Wed, 2 Aug 2023 05:45:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49930 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233451AbjHBJpe (ORCPT ); Wed, 2 Aug 2023 05:45:34 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9DD732D62 for ; Wed, 2 Aug 2023 02:45:22 -0700 (PDT) Received: from dggpemm100001.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4RG6WQ2pXczrS1v; Wed, 2 Aug 2023 17:44:18 +0800 (CST) Received: from localhost.localdomain.localdomain (10.175.113.25) by dggpemm100001.china.huawei.com (7.185.36.93) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Wed, 2 Aug 2023 17:45:20 +0800 From: Kefeng Wang To: Andrew Morton , , CC: Huang Ying , David Hildenbrand , Matthew Wilcox , Kefeng Wang Subject: [PATCH 4/4] mm: migrate: use __folio_test_movable() Date: Wed, 2 Aug 2023 17:53:46 +0800 Message-ID: <20230802095346.87449-5-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230802095346.87449-1-wangkefeng.wang@huawei.com> References: <20230802095346.87449-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.113.25] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpemm100001.china.huawei.com (7.185.36.93) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL, 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773110951857860367 X-GMAIL-MSGID: 1773110951857860367 Use __folio_test_movable(), no need to convert from folio to page. Signed-off-by: Kefeng Wang Reviewed-by: Matthew Wilcox (Oracle) Reviewed-by: David Hildenbrand --- mm/migrate.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/mm/migrate.c b/mm/migrate.c index 4be61f944cac..8590e6f68cf3 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -157,8 +157,8 @@ void putback_movable_pages(struct list_head *l) list_del(&folio->lru); /* * We isolated non-lru movable folio so here we can use - * __PageMovable because LRU folio's mapping cannot have - * PAGE_MAPPING_MOVABLE. + * __folio_test_movable because LRU folio's mapping cannot + * have PAGE_MAPPING_MOVABLE. */ if (unlikely(__folio_test_movable(folio))) { VM_BUG_ON_FOLIO(!folio_test_isolated(folio), folio); @@ -943,7 +943,7 @@ static int move_to_new_folio(struct folio *dst, struct folio *src, enum migrate_mode mode) { int rc = -EAGAIN; - bool is_lru = !__PageMovable(&src->page); + bool is_lru = !__folio_test_movable(src); VM_BUG_ON_FOLIO(!folio_test_locked(src), src); VM_BUG_ON_FOLIO(!folio_test_locked(dst), dst); @@ -990,7 +990,7 @@ static int move_to_new_folio(struct folio *dst, struct folio *src, * src is freed; but stats require that PageAnon be left as PageAnon. */ if (rc == MIGRATEPAGE_SUCCESS) { - if (__PageMovable(&src->page)) { + if (__folio_test_movable(src)) { VM_BUG_ON_FOLIO(!folio_test_isolated(src), src); /* @@ -1082,7 +1082,7 @@ static void migrate_folio_done(struct folio *src, /* * Compaction can migrate also non-LRU pages which are * not accounted to NR_ISOLATED_*. They can be recognized - * as __PageMovable + * as __folio_test_movable */ if (likely(!__folio_test_movable(src))) mod_node_page_state(folio_pgdat(src), NR_ISOLATED_ANON + @@ -1103,7 +1103,7 @@ static int migrate_folio_unmap(new_folio_t get_new_folio, int rc = -EAGAIN; int page_was_mapped = 0; struct anon_vma *anon_vma = NULL; - bool is_lru = !__PageMovable(&src->page); + bool is_lru = !__folio_test_movable(src); bool locked = false; bool dst_locked = false; @@ -1261,7 +1261,7 @@ static int migrate_folio_move(free_folio_t put_new_folio, unsigned long private, int rc; int page_was_mapped = 0; struct anon_vma *anon_vma = NULL; - bool is_lru = !__PageMovable(&src->page); + bool is_lru = !__folio_test_movable(src); struct list_head *prev; __migrate_folio_extract(dst, &page_was_mapped, &anon_vma);