From patchwork Wed Sep 13 09:51:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 13382705 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 C1A69CA5534 for ; Wed, 13 Sep 2023 09:52:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3A4E06B0178; Wed, 13 Sep 2023 05:52:21 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3540E6B0179; Wed, 13 Sep 2023 05:52:21 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 21B976B017A; Wed, 13 Sep 2023 05:52:21 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 0CF676B0178 for ; Wed, 13 Sep 2023 05:52:21 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id E5914B40B0 for ; Wed, 13 Sep 2023 09:52:20 +0000 (UTC) X-FDA: 81231108840.19.2A02EE7 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf14.hostedemail.com (Postfix) with ESMTP id B782E10002A for ; Wed, 13 Sep 2023 09:52:18 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=none; spf=pass (imf14.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1694598739; 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-type: content-transfer-encoding:content-transfer-encoding:in-reply-to: references; bh=5wxhdbweU3Puza/p2mhxBV/J4qb1DjUIWzS1bpTWAAw=; b=m74uZqLQx6FbNFvvsyi6Qk3F0cVH5XXs7ISlkhpxgw5ZfZC/2EpjwSJ0iafVd1N1vu/3D8 u9n7VqD/RWJDvESwkd34cP4UvSQUyo0os02vGTcH0Kipdua0v/Ecqxm1vsWfxTghY1XeI6 7KL/O9ws/i34Qr8fLsJD0stppVhnxjk= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=none; spf=pass (imf14.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1694598739; a=rsa-sha256; cv=none; b=Z1YKs0P8eHOtBTKQfjbD3ls9JBAmSI57BUQIAU5ralQ4zTp+c3hn+qWRz+oNQbTLif9CoR rEL8EWWqMwTrMzckDBna9lbQVn6mCB/WuoeZZTonVFRSQg4/xKf8mQvmc+CemaZ+rpoJod KgbfpynpXiuNxWBrxIyWW5SXaMD/UAE= Received: from dggpemm100001.china.huawei.com (unknown [172.30.72.56]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Rlwdg03lbzVkg7; Wed, 13 Sep 2023 17:49:11 +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:51:58 +0800 From: Kefeng Wang To: Andrew Morton CC: , , , , , Zi Yan , Mike Kravetz , , Kefeng Wang Subject: [PATCH v3 0/8] mm: migrate: more folio conversion and unification Date: Wed, 13 Sep 2023 17:51:23 +0800 Message-ID: <20230913095131.2426871-1-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 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 X-Rspamd-Queue-Id: B782E10002A X-Rspam-User: X-Stat-Signature: rfcuxpfs56txkh5uediw4k54x6tcqwuf X-Rspamd-Server: rspam01 X-HE-Tag: 1694598738-892855 X-HE-Meta: U2FsdGVkX18gytA18QX7OYXEzvSScZMqcdNH9byfMCydHQMUYaCs2HvTAvVLP+SCM1LiCJk6FhyvomO0qrqzq/+JtV5Jc7//qxMa/uB5usYQXfnx1pZP03dPEEbHx67rMxsbpwdvkz0gAE+wLNAtL+b0pwolyeuHpoEH11biqdAikdRci/0Y96ThlhchxLTJz0XMUSWzwdTkeDt4x3NMEZXqs3UKyFBt5GxwUyVsxIfvin8RnPvFoEYMxYpZvUkv2U9MXxlR0yEaoX+P+Kwr5aR/Ymcce5+f7Buk5p5dUerk2CIjQ6RTzNiyRDE6EgjZguwwcn8kA2uD6PR4m0GkXFctJWC5uwl6vdvMYUJbfA8ifEiMNY8Vddft/VLLwJprx9zCT3AnqlWUIdB5JtGd5k2fk8UYgjNqy/HQJfYL47QRhlJwukxvsTWhNKi+lxWZhzCBHqMrx40g5Xo2ZQrIYeisb4ey5E+LhtPBtoZc8cy3xQ+QAR4UajEpOCYaa0JjHcVI1EWVERdk1UTtcMDpQ6F8I0EQbNuI2O/D0d56mLpVtcWArf+/QolbO52I1l2+pbmtJR3m1iFTjiiIzWchIRP/klvp4CoyKnF7vLtJqR1oe+5YafhCSlqYUDmED0AX4MqV0SaD/2NqvBDmslBG0YskqORis+V4tVLc/iDLUGeS3nQcir0S6eFhBy3vBi2rCSjxUnbUTDm7FAtPy+WRMX6z08yAM5/N+DmmxF1WwYtyNGXzbLhmGv4IHoWwysxkwgUnvZEO0diE6zxkRZLEPz4dVPkypTZwDdpZPzTgb7MvEmJ5pVrwQTCGvLOvPBXlzylSSVoGoJpH53WC0qpSlG2YL4KFZdknWB/+9No2SV4fxyaV2HJlDYnyDInfGIFyjWx78/yJj+pvkAUpyNLyRZU261eS3nyZeq5iziACaPP7y+Jhs31m6cQlvxHMZegHQIAsFBvElozCx0dW8xe ygU2CKSP F9Qy0s6vxB5W2YyYg/tCwS5eNh2ofIkUCAmZ1YilZZAcoVYL+jxb0sF+OZqmauH8/QZcvO27HKIgCUbTVnapmin9V5NA/FIul9yU/9MHRHDYAHRVMlN5oCPp6KQ== 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: Convert more migrate functions to use a folio, it is also a preparation for large folio migration support when numa balance. The patch 1~2 remove unexpected specific assert for PageTransHuge page. The Patch 3~6 convert several more migration functions to use folio. 1) add_page_for_migration() used by move_pages 2) migrate_misplaced_page()/numamigrate_isolate_page() used by numa balance The patch 7 remove PageHead() check to make hugetlb to migrate the entire hugetlb page instead of -EACCES errno return when passed the address of a tail page. The patch 8 cleanup to unify and simplify code a bit in add_page_for_migration() Thanks for all comments and suggestions from Matthew, Hugh, Zi, Mike, Huang. v3: - update changelog of patch1 - use folio_estimated_sharers and comment it in migrate_misplaced_folio() - collect RB/ACK - rebased on 6.6-rc1 v2: - keep page_mapcount() check and remove specific assert for PageTransHuge page. - separate patch7 to migrate the entire hugetlb page if a tail page passed, which unified the behavior between HUGETLB and THP when move_page(). Kefeng Wang (8): mm: migrate: remove PageTransHuge check in numamigrate_isolate_page() mm: migrate: remove THP mapcount check in numamigrate_isolate_page() mm: migrate: convert numamigrate_isolate_page() to numamigrate_isolate_folio() mm: migrate: convert migrate_misplaced_page() to migrate_misplaced_folio() mm: migrate: use __folio_test_movable() mm: migrate: use a folio in add_page_for_migration() mm: migrate: remove PageHead() check for HugeTLB in add_page_for_migration() mm: migrate: remove isolated variable in add_page_for_migration() include/linux/migrate.h | 4 +- mm/huge_memory.c | 2 +- mm/memory.c | 2 +- mm/migrate.c | 126 ++++++++++++++++++---------------------- 4 files changed, 62 insertions(+), 72 deletions(-)