From patchwork Thu Mar 21 03:27:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 13598364 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 C2D39C54E58 for ; Thu, 21 Mar 2024 03:29:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id F22646B0093; Wed, 20 Mar 2024 23:28:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CA00D6B0095; Wed, 20 Mar 2024 23:28:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8A6306B0095; Wed, 20 Mar 2024 23:28:56 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 6F03D6B0099 for ; Wed, 20 Mar 2024 23:28:56 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 08BB9C1505 for ; Thu, 21 Mar 2024 03:28:56 +0000 (UTC) X-FDA: 81919614672.16.A60AC41 Received: from szxga04-in.huawei.com (szxga04-in.huawei.com [45.249.212.190]) by imf25.hostedemail.com (Postfix) with ESMTP id CFB93A0016; Thu, 21 Mar 2024 03:28:51 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf25.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.190 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1710991733; 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:in-reply-to:references:references; bh=0c8E7e9kp1IL6OslTDDHbS61rMdEpOestxLQz5M47wM=; b=fM9Cj1/cMA6Us6rY2/g11lJHiIE+6qsnr2fhEVMzugOsx17VQrl3eE+geHaQhkS2IKsoBv ruNn86Di9ELaLknpU3GLvyfkLxzvAnOdGcuUZUsCpi9Fpoio60DOXXtDVQFnOu4PW6pvB1 iofQHQ7dZuKHicd4y7eCbBl2twlSbdY= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf25.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.190 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1710991733; a=rsa-sha256; cv=none; b=LHJs7O/UmX1/LeQOkJDb8/oe1nrKKkcZO3H8Q2o78t5k4UA8l+D5YJWB8ark/aNF5gQGPz WbcMXZ6D0U5siZkigNLoVl/k/AderIGiDUkiICibJEHyVdURIa66/urPSEIy1iT01KvU/I XkXBWl+tUGtsLL1kZX6p7LXRtrf7uns= Received: from mail.maildlp.com (unknown [172.19.163.44]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4V0W861svxz2BgjS; Thu, 21 Mar 2024 11:26:14 +0800 (CST) Received: from dggpemm100001.china.huawei.com (unknown [7.185.36.93]) by mail.maildlp.com (Postfix) with ESMTPS id 4BA6D1400CB; Thu, 21 Mar 2024 11:28:48 +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_256_GCM_SHA384) id 15.1.2507.35; Thu, 21 Mar 2024 11:28:47 +0800 From: Kefeng Wang To: Andrew Morton , CC: Tony Luck , Naoya Horiguchi , Miaohe Lin , Matthew Wilcox , David Hildenbrand , Muchun Song , Benjamin LaHaise , , , , Zi Yan , Jiaqi Yan , Hugh Dickins , Kefeng Wang Subject: [PATCH v1 01/11] mm: migrate: simplify __buffer_migrate_folio() Date: Thu, 21 Mar 2024 11:27:37 +0800 Message-ID: <20240321032747.87694-2-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20240321032747.87694-1-wangkefeng.wang@huawei.com> References: <20240321032747.87694-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggpemm100001.china.huawei.com (7.185.36.93) X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: CFB93A0016 X-Stat-Signature: iceega1d4wrapkof3hyujzfk7n75ooci X-HE-Tag: 1710991731-384963 X-HE-Meta: U2FsdGVkX18PDFBlHWgCr4rQ5KH6gb5IzC+J2kmDpFXca9OPmNQ7XQikXNy9GQXgSqmRwfWFOiHZsAJFBF3ZrF5SEv1EB58UvOYwPSPTMCWYLbs4xFA8oAbS6dcD2tw7P4aHkywBZOWKHpg4jWojM0xyTfc60N3hpikASmOMrznHSfymftITKhQj46xjBLn4LuFbMWsAIhsdJyjE4NPdGhttIdtpm98jFtvG74hvLJbBkZ5OQLeEK7oXxktgFQ4vR+V8WKiKWFQwdL0a63Q8B0cuR0tbYVcYpWTiAmhPfbiCKzpqLNJNIzCYvSdR2mxeb06V95qol0ovTbDR21bO1ZtN2BshcTwLkFLv+RcxHPjRt14tT0HoJBHawBhCaFvgJt+YiWq2D58zm8gUEDXTClIOzERbkf1Z4A9PzFwJL0RxPYMN+YAyFRc3sFbOKvjwz/UWSxHxsUfWdcvGIj/+wGLaFyFXj/GgjP44SDk8xgJEakaHOpCM8invWC61UAzBS6qrElG37WZLBSY0vVIagHlWGCrMmEBX6UTa93NxwtE46JzqO4mIuY2GcUGa8WhzqYw7d3PyW5PgmUFh65QgV2MPdWV5jns+n5zTmL1cD37kzGzt9TUgfyWEw2g83ZVNzGuaC2TELFB6TvBwaawXn3QU7LlT3WueuQyuq7AbXWElI5pY1oR+iv4+FvrWchsgUeMxFn1XBsiKM7y7tL5HMAHQBu8bVHP3WJss1dp9gdH4kKF7G3SvE3eKl0vuWXwce5+x6XJuxNFg5WMegaqQ4uYFKNlXNC8T6yyIYICBDIWmXe5F/cTGuYzsTUxHQ+NXc9+jT5T1YvuOs7i3+RLISfSVG3/KcY3zMd5Ig2ExddEThS0Ljrs3KHYVBAkRDPegAmnA+NcF7hmp5LlJ/7iaLiyH4fM5Ikk2eQeGzoEgzEwI0p/gjvWJuNyzwcJsmvaJLfyuiITDLqxx+WQ95YS es6vHlt6 6LzUo7aON9jQV2SUq/1C8lyRwnUfWcnVkoNSXRVfoJkbrtT+Zwn20MjyNs6Xrsjbqb9DZ1MWZBZNEfUND6yZmBg5ZhuldQxwoX/0yeV301B8mfWysgvMhOKrby8ByhYYW+fWEi0PEpnnIFAxtRYqXdIGkA1gA3xbbP2cQr/yYsghLLt2NxpHS676p74foqvIsChB8mrO1jWNAy78s8xeklyoNBJkqJdzC2vElvd9Hwe+d5CdqHq5/a5SAKeVRQyykCOqM 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: List-Subscribe: List-Unsubscribe: Use filemap_migrate_folio() helper to simplify __buffer_migrate_folio(). Reviewed-by: Matthew Wilcox (Oracle) Signed-off-by: Kefeng Wang Reviewed-by: Vishal Moola (Oracle) Reviewed-by: Miaohe Lin --- mm/migrate.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/mm/migrate.c b/mm/migrate.c index 73a052a382f1..cb4cbaa42a35 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -777,24 +777,16 @@ static int __buffer_migrate_folio(struct address_space *mapping, } } - rc = folio_migrate_mapping(mapping, dst, src, 0); + rc = filemap_migrate_folio(mapping, dst, src, mode); if (rc != MIGRATEPAGE_SUCCESS) goto unlock_buffers; - folio_attach_private(dst, folio_detach_private(src)); - bh = head; do { folio_set_bh(bh, dst, bh_offset(bh)); bh = bh->b_this_page; } while (bh != head); - if (mode != MIGRATE_SYNC_NO_COPY) - folio_migrate_copy(dst, src); - else - folio_migrate_flags(dst, src); - - rc = MIGRATEPAGE_SUCCESS; unlock_buffers: if (check_refs) spin_unlock(&mapping->i_private_lock);