From patchwork Tue Mar 26 20:28:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13605073 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 4DB61C54E67 for ; Tue, 26 Mar 2024 20:28:54 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9FE326B009B; Tue, 26 Mar 2024 16:28:41 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 939E26B0096; Tue, 26 Mar 2024 16:28:41 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7B3196B009E; Tue, 26 Mar 2024 16:28:41 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 63BC66B0096 for ; Tue, 26 Mar 2024 16:28:41 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 300DC140431 for ; Tue, 26 Mar 2024 20:28:41 +0000 (UTC) X-FDA: 81940328442.22.A1633CC Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf11.hostedemail.com (Postfix) with ESMTP id A74F14000C for ; Tue, 26 Mar 2024 20:28:39 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=ZAeDBXor; dmarc=none; spf=none (imf11.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1711484919; 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=kpw//YUN/Z8trrNfMYgvIjdADXKrm2X8DtHY91ODnyE=; b=veQVYUohgBmRSRK4oWPB8m/ZQ0WvmOULB48RM1Tzf9FVaC+s6zbW37mYSKts+8gpNPutUU nuw+aQgW0OtgKMH57gAotgvxwGtdPESKPTnOtKuz4OKZeVFJabfziAFHxhRBqoo6Jczdvs 1nQFbkSM+oSTZcORsHpi+7JcSLSxKWc= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=ZAeDBXor; dmarc=none; spf=none (imf11.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1711484919; a=rsa-sha256; cv=none; b=7+AYrV5P2TOMNFS24q5g6zimBEd28NzhaCAY5Mhmu/zP4gkQwDci9AkDQ1tkraad4DeSSC 6Fuf0TL+MkCPxt1Mh0uWCwS+/BurUhkBLXPfMaXQ1W1D79Le31CGwA3XBqWZRmTkm6mY4k oMnGTphdeXYAzFDSKLAbEQW/4CqWQXQ= 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=kpw//YUN/Z8trrNfMYgvIjdADXKrm2X8DtHY91ODnyE=; b=ZAeDBXorkmz6TIILRtABrSJ9sy A2mpPilG74gqWzMeJkTQQTa+KXY7hqpIwViWebt1fE+Iae7Scku4yKWlJBc7fMMve5UCnSLzRaIuL zLLxZOUYdNfTB7TWJlRckMExgUHODfCUjpODqSNx3SHgaeI+fgF3PAyDQ6U+uji0Gol6kWCLVH2gK HmRMLpJ3q1G3xv/t81Dx7z6hGYwHPA/w/YUPbeDgmGiXkGgNqIg+LD+xW5yUbZIIu6789VwDmvWjP udIjUBcUAzKkHVXGM5l9+pA+gTXM8fSRZ3ZdN//MkCxdEd8TVU4rIuaj9ZrZS9ZnFGtc+nnMcVG+e a2V/zLiA==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rpDPQ-00000002CGX-317V; Tue, 26 Mar 2024 20:28:36 +0000 From: "Matthew Wilcox (Oracle)" To: Andrew Morton Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org Subject: [PATCH 4/8] mm: Convert migrate_vma_collect_pmd to use a folio Date: Tue, 26 Mar 2024 20:28:24 +0000 Message-ID: <20240326202833.523759-5-willy@infradead.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240326202833.523759-1-willy@infradead.org> References: <20240326202833.523759-1-willy@infradead.org> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: A74F14000C X-Stat-Signature: kh9b5pbcq7buj55asw555e7wmi6bjm8f X-HE-Tag: 1711484919-874469 X-HE-Meta: U2FsdGVkX1/gIFI+H0zp2n/DV8i8FIKVT6yJD86y5VsL5A6DApX0lWrKSYAaxKljtJP8EBSJEMjqCWBhWaKwCI90pWQFdYcihj4DgQGhImZEAZSOYPfLXotQg/DIcMi90bMQcV3oV+1oBa8+9d0EYUoz103bJNyAnn9qTlNv/mHKfd/kB29jLguxdgb5ZDKVWDZomDW+NLUcO8GsbGIbe6RtnDDaipO7lySy75SBVrL378vINTVCyXMbk+dBdLCUX8blsEFCVwd6dqZP9MgcZyT7rUe/p7QmdHY4VCBBoM8mU4+OA5xtiv2AFMtYIgfplsxaKCC4hhve5InnGDXzSrSx8qWvr8H0IXZQsYvOre8n1VspigXtSM23XRAr1LRrf5Jvfy2S8UnuUpOAu/PYH0EkcqNVJcElhEw85Qw+hj2yRowKl46bBU0SKbg/svIx9NFz9WXqtq7YLfhGz7vzySxiRdzB2pm2jXea+HmOf8ChwPPmMywprqF4XzAzwWA6cWEluisJpwweciC54Hlvgh1boprHiESe7Ar2Gjf4F9EuAG0v0HlT22r7EV8TroV+Q+qpyO9qxVkIjPXBlOvlPqs9YFpaKdL97lzRgX50OVWaujOBiaAdxkz0vsrwWh6L6R0F2Ef0iDqc8D5TipUgFCisSxsDRhODM15ELDsX+zCpUKkrNtSAOIREBB2CCNhGW5f83lp5zxvgIJyspowxcDZ6AF/nr/QFoee2v2H4thTurdWoTymtRdFDkY/KAl6F5usmbSTIIeO0rhEaU2NA6UmqajUgGP/TifCFzRYkZQBZokp7JUw/KqJpfTkfrijQTSZhaZtAmorycUbPFjocPDnnq7sFQ/+qhUzJpefwboCK487B6z3Ocn+XU5fx0dLwrOjYyFmtfpxbNpHKljUDzek2nc1MagI8 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: Convert the pmd directly to a folio and use it. Turns four calls to compound_head() into one. Signed-off-by: Matthew Wilcox (Oracle) --- mm/migrate_device.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/mm/migrate_device.c b/mm/migrate_device.c index b6c27c76e1a0..d40b46ae9d65 100644 --- a/mm/migrate_device.c +++ b/mm/migrate_device.c @@ -71,7 +71,7 @@ static int migrate_vma_collect_pmd(pmd_t *pmdp, return migrate_vma_collect_hole(start, end, -1, walk); if (pmd_trans_huge(*pmdp)) { - struct page *page; + struct folio *folio; ptl = pmd_lock(mm, pmdp); if (unlikely(!pmd_trans_huge(*pmdp))) { @@ -79,21 +79,21 @@ static int migrate_vma_collect_pmd(pmd_t *pmdp, goto again; } - page = pmd_page(*pmdp); - if (is_huge_zero_page(page)) { + folio = pmd_folio(*pmdp); + if (is_huge_zero_folio(folio)) { spin_unlock(ptl); split_huge_pmd(vma, pmdp, addr); } else { int ret; - get_page(page); + folio_get(folio); spin_unlock(ptl); - if (unlikely(!trylock_page(page))) + if (unlikely(!folio_trylock(folio))) return migrate_vma_collect_skip(start, end, walk); - ret = split_huge_page(page); - unlock_page(page); - put_page(page); + ret = split_folio(folio); + folio_unlock(folio); + folio_put(folio); if (ret) return migrate_vma_collect_skip(start, end, walk);