From patchwork Tue Apr 23 22:55:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13640864 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 6D2EDC4345F for ; Tue, 23 Apr 2024 22:56:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5D2766B018A; Tue, 23 Apr 2024 18:56:00 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5817E6B018B; Tue, 23 Apr 2024 18:56:00 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 470366B018C; Tue, 23 Apr 2024 18:56:00 -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 2F6A56B018A for ; Tue, 23 Apr 2024 18:56:00 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id A9BE6C0E42 for ; Tue, 23 Apr 2024 22:55:59 +0000 (UTC) X-FDA: 82042306038.14.F433EEB Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf23.hostedemail.com (Postfix) with ESMTP id 64EE914000C for ; Tue, 23 Apr 2024 22:55:57 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=fWz1hx0j; spf=none (imf23.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1713912958; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=HkiZG9m0iZUn7YHN2uAFIsSMCWAiQIiQFvg2/jh9MHY=; b=DV4pQgrCbxWaF/2Ejb05IVVDgXn6OYOP+9Dtag+sS098ZMOVJQsYq8L5knAaKk2Oe96ioU 8EZKsEXyM1Mx9TfCAfV+2gDNB5aIKyVXiK4C7efiIvuDOOjv1NvuVSngc2Zxm19fI5M6CR V8V9AjFFDhzFbLMly8Vm2r0F0EtpQvo= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1713912958; a=rsa-sha256; cv=none; b=iaucu4i4RbzpGfFmBJX4HIt54eh0G29J060PUcrm1k1aoFFHZMzmt/4Uny919lDzAOdA+4 CAxZU43jo9HvqOfpjyIE1TwSR1+McBqKIqIZ0Gp+kwSi6APrWr6pxKDsZwKrDugYJCVpy5 qOYqUeIKptYJe4T08zQL8zfJImjHVTc= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=fWz1hx0j; spf=none (imf23.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=HkiZG9m0iZUn7YHN2uAFIsSMCWAiQIiQFvg2/jh9MHY=; b=fWz1hx0jDqtp05rXrTDwSTlW1l oZeuyvzFJHEc/0+YW3p1DyW3UWM9dRaBZjHbmz1C2E2jOB081Aye+WIX7P/XqgdmV3Q8eP/iI/ryH IBIzcVOSH1sK7V8oDiocBKo6gv42nFvkExjp6vRYblqvxaazX6cDDC4vZtSxOcaBVbPeheHmXvL2Y k/WZKL/TVFnczAEaKfgpo7QUMvQsNxDyf8R9tZI3BePQ/lc9p6Ng0uqXMg0uvh1mlm/8c0PzoZq/D JiJEX09m8u2IIH8YhGn/N7Fv7wzw5XCysAFi3vVgjr8VPfs3ZvqeDOJCkoh8FHu8h1YQzPomRTlhV f6LivFTw==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rzP3K-0000000HG6K-2IMq; Tue, 23 Apr 2024 22:55:54 +0000 From: "Matthew Wilcox (Oracle)" To: Andrew Morton , linux-mm@kvack.org Cc: "Matthew Wilcox (Oracle)" , linux-fsdevel@vger.kernel.org, linux-fscrypt@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net Subject: [PATCH 4/6] migrate: Expand the use of folio in __migrate_device_pages() Date: Tue, 23 Apr 2024 23:55:35 +0100 Message-ID: <20240423225552.4113447-5-willy@infradead.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240423225552.4113447-1-willy@infradead.org> References: <20240423225552.4113447-1-willy@infradead.org> MIME-Version: 1.0 X-Stat-Signature: d6s1t5bcbuf1cqtoogmfbkhsijwscdx3 X-Rspamd-Queue-Id: 64EE914000C X-Rspamd-Server: rspam06 X-Rspam-User: X-HE-Tag: 1713912957-265213 X-HE-Meta: U2FsdGVkX18pWmfJITSo3rhW5vY4MGb5d951cIZ3cCUoP9ee+WGcFb0DSSnL9AoL7lCmYUhktERV9DoNOxRkFtlNkyCykBGeo0XYydJF2WdgBriNtPVlrZ7lKby0SLLbv7plWDnbv0X49teUgkDkeK1ZvpJms+HQZ7Rc7CvSbWrHnUwbzxgVF7inujeI6J+Rk3KvI8NGpfkjjvdKU+od0l15MjwKGrvjU/7G/ICTmd2GZ0uxoCV9AeGKLAZ8FwLuR+yu9ezDANRGhD2/ZFj3+nz9blEFmW5USJO56iRLv+e8kh3v91TlhhHHlM8ed+DrNBWHjVnR6PezGv2hC86fWsoWZ+JxHr+k+67tkk/HwbosTfiU+U0wbElbI1lK/yCNaftlBoykpryIoLLm+Pn2lPuHI/c59jQtfLeFIuYOmnV3xZN0Zw+Gi1C7LWU9TEgZuNUTWLhIqoQAFZZ+na3y+8wr6yAbKMfDS8kggLejY/jT5pJVQ5e/5K7bm7gE16iCi2VVilc589UnBCNO+0BH21Td77usm+R7HreQy3tcS8wrCzVXiQ135LmiWglarJVD9sAbjoIjxYyZUV8Q2DgO8tzBoEXIBzB91oX6EWsdIRysWsSogyFnJnJ5EA+J+ziRQ/BCEZsAauLX5GLJ0F6vIj/WWCu0KT3N145SwNpzwL1HOK/wMAvatKvtLmxJg36E9CWwJrQYDO6OmqHFt0c1MZZbi0xcWWrp5X82DqIlDlTHNtBexIS4pkbWClUbEYLH2QRtptW7kngCBQ3MK6AIqMbGVMmhpDY4ZbLVQkLueurTLvXlcu7g9SVsF58Huumi5logi6TxMdfdXO73ftscPvssZwmS4jcko9wHlC1XrfKeW2Jk7Aqto2x6DDYZ5Z0pt2NS2ifexBhhup3PPY/pvvTSurox9kXwRVb82rHf/5bvNYEX87ZkZxJYIPsX1Y+K7jHUOXCR6kqgu3RvGEo 5q7Nxqof Lrmi5kA9Nq9e7+eVFXZ0uOF8yScJdizqu4r1bBmbS8zV9+B/2TwG+pBggaSYthZNGy4x3PgD0CHDqBxdNAUN6cjhZxUDxlJ+RbTWUMQOxYdVdZTCa3NnTRbrPrMKUhInZVP38Thjw5k8hW1lMsvCauNykovkjdOoESJStfQDiVEW4synLPeP10xHmW6VpWzmHp0Solq9yF6ITaBcHRdsYyayJdYhPAG7NFG2g 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: Removes a few calls to compound_head() and a call to page_mapping(). Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: David Hildenbrand --- mm/migrate_device.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/mm/migrate_device.c b/mm/migrate_device.c index a68616c1965f..aecc71972a87 100644 --- a/mm/migrate_device.c +++ b/mm/migrate_device.c @@ -692,6 +692,7 @@ static void __migrate_device_pages(unsigned long *src_pfns, struct page *newpage = migrate_pfn_to_page(dst_pfns[i]); struct page *page = migrate_pfn_to_page(src_pfns[i]); struct address_space *mapping; + struct folio *folio; int r; if (!newpage) { @@ -726,15 +727,12 @@ static void __migrate_device_pages(unsigned long *src_pfns, continue; } - mapping = page_mapping(page); + folio = page_folio(page); + mapping = folio_mapping(folio); if (is_device_private_page(newpage) || is_device_coherent_page(newpage)) { if (mapping) { - struct folio *folio; - - folio = page_folio(page); - /* * For now only support anonymous memory migrating to * device private or coherent memory. @@ -757,11 +755,10 @@ static void __migrate_device_pages(unsigned long *src_pfns, if (migrate && migrate->fault_page == page) r = migrate_folio_extra(mapping, page_folio(newpage), - page_folio(page), - MIGRATE_SYNC_NO_COPY, 1); + folio, MIGRATE_SYNC_NO_COPY, 1); else r = migrate_folio(mapping, page_folio(newpage), - page_folio(page), MIGRATE_SYNC_NO_COPY); + folio, MIGRATE_SYNC_NO_COPY); if (r != MIGRATEPAGE_SUCCESS) src_pfns[i] &= ~MIGRATE_PFN_MIGRATE; }