From patchwork Mon Jan 29 07:09:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 13535062 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 68FE8C48285 for ; Mon, 29 Jan 2024 07:10:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A11786B007D; Mon, 29 Jan 2024 02:09:59 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 92A026B0081; Mon, 29 Jan 2024 02:09:59 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5F56A6B0083; Mon, 29 Jan 2024 02:09:59 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 42C9B6B0087 for ; Mon, 29 Jan 2024 02:09:59 -0500 (EST) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id F3DCF406C0 for ; Mon, 29 Jan 2024 07:09:58 +0000 (UTC) X-FDA: 81731474076.24.392180A Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by imf07.hostedemail.com (Postfix) with ESMTP id 99B9540018; Mon, 29 Jan 2024 07:09:54 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf07.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.255 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=1706512196; 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=cqpxQBobUaCVBevYaT8TLpoPhlEky37V62DAGEAQTEU=; b=Y0Siph6hN2cNj82GFLPJuq915VCUXN4TuJNnYgA8vRGcHhtXoLnpwI1oKr8DYyY3J1kLou Q3avhmXC/YUUrTu/lQDoiCY40Dj8WodRVdWVKJAsUbv2MKU2hHNsnjpq/rA531tp31Yd6J JoofV7Ekpp0sIzmgdu8vVOCQeKHyneo= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf07.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.255 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1706512196; a=rsa-sha256; cv=none; b=1qIWeFYJD8mhOcP8t1hxU4fu89/lio/bWeACglg0K98VG81zqsZtJYjzyWFLX860v1ewk9 ay0iUaxZsOB7EErAUInPWvLIiV8P69ofOpGeEOosa+MhyrYDJl//bSjVcYiK0n0JXAQ+fF kEXI03HHnrjZdEsQJZLvuRHXW5AYDtI= Received: from mail.maildlp.com (unknown [172.19.88.105]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4TNfXj5rQ5z1Q8Xf; Mon, 29 Jan 2024 15:08:37 +0800 (CST) Received: from dggpemm100001.china.huawei.com (unknown [7.185.36.93]) by mail.maildlp.com (Postfix) with ESMTPS id D604D140EB7; Mon, 29 Jan 2024 15:09:46 +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.35; Mon, 29 Jan 2024 15:09:46 +0800 From: Kefeng Wang To: Andrew Morton , CC: Tony Luck , Naoya Horiguchi , Miaohe Lin , Matthew Wilcox , David Hildenbrand , Muchun Song , Benjamin LaHaise , , , , Kefeng Wang Subject: [PATCH rfc 1/9] mm: migrate: simplify __buffer_migrate_folio() Date: Mon, 29 Jan 2024 15:09:26 +0800 Message-ID: <20240129070934.3717659-2-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20240129070934.3717659-1-wangkefeng.wang@huawei.com> References: <20240129070934.3717659-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpemm100001.china.huawei.com (7.185.36.93) X-Rspamd-Queue-Id: 99B9540018 X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: 3heasezb59sd9ed9zqiomzd6gy8bd4h9 X-HE-Tag: 1706512194-8493 X-HE-Meta: U2FsdGVkX18juRag52qp9RvC/gyovUXjYQGQ8wD9oMSp+uOH3ZiXjYsr+639+SQxJT1WiWpHD2EGFV0US6qF7lpOo7fYT2fSKFvMOcKv1b8CdYywJoo71EOlzmXxIVBNsTewT+lMeoEsalOiNMaf63Mx3AGMEzkZ4A5fpbg5t4IvcyvUihn4sPDCujRX6ElvPKwkbXl+VBTYIUzJQ3YJCpVdxCdorpz5nUIAymHx0gkeuozzt95hEgpYWU4x93jeDkoz/m3iMBk/lUWaRxt+8oOLMTHltBsU5UTQCSEaK5kUyIkx2id0tu8svZYBDzRXYbpQ6ACS1QE/I7Ya+IYRVOTJxmiJR1gDm8l3AHyPwfFnH1Y5XgSiJMxdqSzH792uqitVqxl1wm+WFxKkGT5pWbi2t+YAoEgTFvUg71CT5/vKQd20hs4n+kWRXYEYgNAK5rlRT0f0qyR5slZu+IBIDD4Uq4ro6hRZ/c1C0aRy/aUHVnNWMtj/Tc8sxhojN1p1mNS2TJ6zSRaM/hzj4MsXilpozWlZoOzq1RVH6suIyUwUMYSSxh23ylwq8trD0snHFsuf6u3sP0z53QuJprawxuHK89mhrsX61fTHKozGbSSwYPG4fKpMb23YA3pQsGPj9BjP+lWlKS/LBF17fqxm2yYWmCBCiWgpk8bjIJWBTOPGCRRvv7V/3olQolCz63V1FwnLOFw3kfMWqe2NM7bAV0INhSt8rNWtE5E1Ox2a9RSQqcKM5bS8/nDF3DJRWTuhuW23n9tq4btgm83JRbZhhQkZzq+H7j+4xPjVANgNqOZLT3rfmYBknNSnSEWlgqjgNvVWQQGFUSPGoA3zEkmIQLMF9bgt3JH8zrl+QtPUa5X4cFe9qQ/K63bujdYYBbxWP2fJfHzve6iLEKRONOcLB7/VabVhpKTpV63q3a106bClpkeHF3wvYa9p4ojXQNzk3rYEglERMctFMRX/9Ue iAOxYaxq hpwbjf1TSLcqBAKxFwgzSkv0VXKu1fAOwzAq6mdat9wPeJN0VNSpgj9a48bUzSAaTfdM14RhP/dq0rrIComPldcYy1Pu+aiNQFN6f/Y9Q8eOPg15Y3JW6KudvpY3myzWwLYBcMfT5gEFkkcykkBEJ4vL2NQqH3slYIss0mezlgHaQdhBXZ1IDJYjYR5FRZ0tNip1u 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(). Signed-off-by: Kefeng Wang Reviewed-by: Matthew Wilcox (Oracle) --- mm/migrate.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/mm/migrate.c b/mm/migrate.c index cc9f2bcd73b4..cdae25b7105f 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -774,24 +774,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);