Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp3130933rdb; Wed, 13 Sep 2023 03:06:47 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFjmNiY7JzvNsCfR2cz8UpM0g88UgNNwmCtpiqVs2NuwiHajlnMLQNhUo1GdvU7fZcTXryw X-Received: by 2002:a17:902:ea0a:b0:1bb:b30e:4364 with SMTP id s10-20020a170902ea0a00b001bbb30e4364mr2645326plg.39.1694599607681; Wed, 13 Sep 2023 03:06:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694599607; cv=none; d=google.com; s=arc-20160816; b=wy9V9PK1Tyl7kBIzSef6aXkL95LL3u0axgUYTgvaoB7tUop+EYSI3IsaiIUZ/r2nIQ ITOaErqXZPdkh0xSr53j3XfYzEb34bRIRWEKWDOblnvvnxlx+CCTEMofBOvrg1+to7Z0 1Xmyq7VYuErH9Rex7akfcVHKfChT1z7tqYLJO3t77XtbBVb957SHOD+jlOm1NuX9Bx3b iwXPmoI6Qa68zCkCt4GP0+ahEnob9a1C1NS2zkmy3B0SfTuDG39VRmdDt3mWdIIkq5cO dQg5d8bYQf2KiMSa30DpJ8ZUyAde8f25z8OlnnRCrVvqIYS4o4XExveGmmZ5StNJ5sKw eqNg== 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=tynzkeTlgRE0TnuNJwLboivyiix4m9++Sswl3Rc9Qjw=; fh=Je6qNyAM729b1goCtB6PkBk+yQrlQCIjJMRY6BFgKTo=; b=QMHgS5bZtpuNw5sgRQN8SZMRTohemtjGqwywMOdGRDvzUr4jkhBkWohTesX07urVDq MpYqpmeYvwxtdzDtMWbU7MLf19eG5KtfA4NB6a+x93LD+7HptTww2h5KNAG2B+nghw91 dIJJZrustCDsm0NSuSJ7zwMONMjFVBRfj8NNG2lm66ZjD4FiLbgihQneS/CLQY+B9T6z pMV9v3g+E8n84rkuu1LezGOSsvExl44Qz6TIbb08LeQTHxYLRiWHOmHQwaJu9wEFnhDw BSU2791Yemkg+moOP8Kfa8pVkSIABuIs2HDwwFGc13zXleFYudRPxYRUT8BjsIRRdfGT NXSg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id x6-20020a170902ec8600b001c382ba4f5bsi10127323plg.434.2023.09.13.03.06.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 03:06:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id A659C82DC610; Wed, 13 Sep 2023 02:52:31 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239592AbjIMJwU (ORCPT + 99 others); Wed, 13 Sep 2023 05:52:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37732 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239489AbjIMJwI (ORCPT ); Wed, 13 Sep 2023 05:52:08 -0400 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B246A19BD for ; Wed, 13 Sep 2023 02:52:04 -0700 (PDT) Received: from dggpemm100001.china.huawei.com (unknown [172.30.72.57]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4Rlwfh3mXTz1N7wJ; Wed, 13 Sep 2023 17:50:04 +0800 (CST) Received: from localhost.localdomain (10.175.112.125) 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.31; Wed, 13 Sep 2023 17:52:00 +0800 From: Kefeng Wang To: Andrew Morton CC: , , , , , Zi Yan , Mike Kravetz , , Kefeng Wang Subject: [PATCH v3 5/8] mm: migrate: use __folio_test_movable() Date: Wed, 13 Sep 2023 17:51:28 +0800 Message-ID: <20230913095131.2426871-6-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20230913095131.2426871-1-wangkefeng.wang@huawei.com> References: <20230913095131.2426871-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggpemm100001.china.huawei.com (7.185.36.93) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Wed, 13 Sep 2023 02:52:31 -0700 (PDT) Use __folio_test_movable(), no need to convert from folio to page again. Reviewed-by: Matthew Wilcox (Oracle) Reviewed-by: David Hildenbrand Reviewed-by: Zi Yan Signed-off-by: Kefeng Wang --- mm/migrate.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/mm/migrate.c b/mm/migrate.c index caf60b58b44c..264923aac04e 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); -- 2.27.0