From patchwork Thu Jun 27 00:54:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Popple X-Patchwork-Id: 13713668 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 3C266C30653 for ; Thu, 27 Jun 2024 00:57:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BD2686B00A8; Wed, 26 Jun 2024 20:57:03 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B4EB46B00A9; Wed, 26 Jun 2024 20:57:03 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 92C4E6B00AA; Wed, 26 Jun 2024 20:57:03 -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 759806B00A8 for ; Wed, 26 Jun 2024 20:57:03 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 33031A4511 for ; Thu, 27 Jun 2024 00:57:03 +0000 (UTC) X-FDA: 82274854326.21.7A27279 Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02on2062.outbound.protection.outlook.com [40.107.212.62]) by imf06.hostedemail.com (Postfix) with ESMTP id 67D30180007 for ; Thu, 27 Jun 2024 00:57:00 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=bMoKliPN; spf=pass (imf06.hostedemail.com: domain of apopple@nvidia.com designates 40.107.212.62 as permitted sender) smtp.mailfrom=apopple@nvidia.com; dmarc=pass (policy=reject) header.from=nvidia.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1719449812; 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:dkim-signature; bh=DsYaUBCkuUfLI8QjlhZUT1HmKGLGEWzFA52wvG9NRck=; b=xxASpn0gSiIYbP59IqjuPmaAxkCuURSfiRlUV0bxcEPADOQ30SxjpM5Dt8HHIMeq9LTshB RUxzKJskbB+iiYzwuh6yVMJgnwoBi3L9OjfCCo7/riTdjapKZXhmK4PlqfWz1viOlrxjze Y22CdY1851loO6q2hsUSO910Jlo/DNM= ARC-Authentication-Results: i=2; imf06.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=bMoKliPN; spf=pass (imf06.hostedemail.com: domain of apopple@nvidia.com designates 40.107.212.62 as permitted sender) smtp.mailfrom=apopple@nvidia.com; dmarc=pass (policy=reject) header.from=nvidia.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1719449812; a=rsa-sha256; cv=pass; b=eBV3pPw9pTOcB7CtfOQ7HJ+Fa1u+e5alZ8AYVmie8D7fBQzX6pD5G6GwOIjbMWSwvsMzHa ObqZWVXJ9vaJQA9TSL6ioFqzKb8Ztf9SHF1o93G0qQA0CaP7HClmfBd0Y1ORhZQ7+7bhJh o8eRpJklFsMI9xpVmotolJJh8QDRnKs= ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=keJBOwRGFG/pJQwSNpKUkjNyRSWJeCklVuQhgx3s212I/NQaLQ6ABgwbLn9eAwIL75r3q41mtIV/zaBjdSY8TrY2oadbDxnsBWaqhf40nhYY6DTue8AlLgx4eF1U3mXqg+6NYlRtv2/OWkVt2HzIe2hsPNFzzimd8a4Uwef6fU0vxljPcQvbgFx/0I4XJokQdY7U5XAnGTJjASUjVzcIjZ+uim0urPZn7LxdL884z0sAbIw6XYSuypCcyu8+A7EJeOZv7b9h9TBEELc8wtEIGsCyoD0Gr7/wWYqaDMR+JrhWiNfLL6arJKQLTldrwu4AJ96tSSa2N0Wi2Ao3/N/LqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=DsYaUBCkuUfLI8QjlhZUT1HmKGLGEWzFA52wvG9NRck=; b=WLWlQpP2t9e9LqsHkkyTGP1RTFsQp3YpGkDq1zC2IPgwbAvsThu+3j5NxbjUCPtVU6RE40Ho8Zl536a4iayqIEIXItK8UG4dZzGv5vn2aU8znXd4Y/m/WiuPxqH8oIL7HZY2A5v+pKTE75kOAwvDv3AXWnVaw7+mQ+gx/bcUtRzN8whVYWWTkHliwkcYgDTo1TgSyBZNP/4LOnfBThgJlugkPJ+HxWHJbwSaFSDeyBldF7EhYdo1hegEfaRt94Oob6gAZlqLQAoIHp0OSCCyBflvq+wUsYZ3p/WivZ2IVhHTohhWgYILrVmSOXT/+6SEx7IweyjGqSaavfTckRFUEA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=DsYaUBCkuUfLI8QjlhZUT1HmKGLGEWzFA52wvG9NRck=; b=bMoKliPNLkTD5NJQHjSbpo0q0aR9jxToaqUxxewo4j9lJc8GQGmIsQNHbHRh0bxH2qJcsJpDbcMrrJPFSEmzmH6k5qi5np2FW+zWrHNP7oeujCmXkPxSfF0Jdzer+fwkGbwQunlTYTtmNVWszPjfYsYz5Q6gMIpJhmJd+pWgAbMaYuUGJOW3t8VWrIF4EN/w+woXy6Zh5Zjoz9ILqSqrDIq1T3Y4e+382UtTFJklNqeEPz5saf4YKUXJJ2eNv4wYRRcaecd0AOj777JYcmIjqZDAt3cJFSsec3+PasomRsKs2ByoW8okS9O113D4MAYHSXaal++dJWVJp8UVRrtE6Q== Received: from DS0PR12MB7726.namprd12.prod.outlook.com (2603:10b6:8:130::6) by DM4PR12MB6183.namprd12.prod.outlook.com (2603:10b6:8:a7::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7698.32; Thu, 27 Jun 2024 00:55:30 +0000 Received: from DS0PR12MB7726.namprd12.prod.outlook.com ([fe80::953f:2f80:90c5:67fe]) by DS0PR12MB7726.namprd12.prod.outlook.com ([fe80::953f:2f80:90c5:67fe%6]) with mapi id 15.20.7698.025; Thu, 27 Jun 2024 00:55:30 +0000 From: Alistair Popple To: dan.j.williams@intel.com, vishal.l.verma@intel.com, dave.jiang@intel.com, logang@deltatee.com, bhelgaas@google.com, jack@suse.cz, jgg@ziepe.ca Cc: catalin.marinas@arm.com, will@kernel.org, mpe@ellerman.id.au, npiggin@gmail.com, dave.hansen@linux.intel.com, ira.weiny@intel.com, willy@infradead.org, djwong@kernel.org, tytso@mit.edu, linmiaohe@huawei.com, david@redhat.com, peterx@redhat.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, nvdimm@lists.linux.dev, linux-cxl@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-ext4@vger.kernel.org, linux-xfs@vger.kernel.org, jhubbard@nvidia.com, hch@lst.de, david@fromorbit.com, Alistair Popple Subject: [PATCH 11/13] huge_memory: Remove dead vmf_insert_pXd code Date: Thu, 27 Jun 2024 10:54:26 +1000 Message-ID: <400a4584f6f628998a7093aee49d9f86c592754b.1719386613.git-series.apopple@nvidia.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: X-ClientProxiedBy: SY5PR01CA0090.ausprd01.prod.outlook.com (2603:10c6:10:1f5::11) To DS0PR12MB7726.namprd12.prod.outlook.com (2603:10b6:8:130::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS0PR12MB7726:EE_|DM4PR12MB6183:EE_ X-MS-Office365-Filtering-Correlation-Id: 6b039b55-0ef5-4bc4-9156-08dc9643d799 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|376014|7416014|1800799024; X-Microsoft-Antispam-Message-Info: HhNt7wNo5Ywpna3dyfeB5cgUjaDxpxa3A173EDtjSYH+3Jx6l+UFNG1xvKpUPRAX3k+LD7tp2sojxyt3inm20AE4JyK1wjqPK9GLL3KBwsK6daRuFWdtD+mVp75O6qTFkP2SufskWm9Oq6tThJQq4HQBrTLR+gQfFuPNIcUq3X9rwrEef2lMZRu4fFoIGZkmqkUI9WXl7q2NbJWHVO2UHtXKL1m9hBYX+1uUGajsvE3bUBUjkCARV2IRwcYKp8BqCWnJNHFyfuQ75tF1wxOS3NRibxdkBLlpGD2VVnrDkAauK5Mf2v9uDUSC6+RvJdM1rtl1MhYsVPsdEeopT+6AiniXPDtpD5nYSd1U9JVz9L/P2MgSwjL0cQQ4DX4CAnbOJjWIfTuQSAELGITkok3UFGauUk9+lnGSGf9eq+gCRmvR+ZytEzrJebl2lYoqq3Xu5qgWpBl6z/X9qlt6YWlC5vUAiDwlgcUI8RM2NY60FVfTuJhl3jU2iMi+JFHtaUZRr77ootRYzlbHsXBf/qWesvehfUbmHatv8TZMPbIMBpbexGHUURc8Wwjql0VEhdq2IKo2dDLKV9jNjlQtT8X5e1hzVbloE07sIObgBXmTxtUv1Vdj/ErgRxtm8/RRwy2ZwoJaMFJ6MoS/oRBdeILXF08c4qX8YE8w1emk8IviHfB9c0O461PU3YoYUOjZY2SuRtCwjFRijOrLGSjw3SeR3V+qkxspxOuxA4i4uWczU1VOqIvXRKlwQ8v2LCNawLwkAP5SdcdJ6giYajacCa92Sop9DKrAinYD68XUPebXT+0pvfAWzQ4rK9MtbasDSZSqfo9m5pqbE56u7B4Y1JLszV+TBkBngM9pSB1Z2EV2bz+26FJdzsPVQRNOo+q8Tkp1fFcOINeDqSdgkcybEhBwdHal0FWoayhbyyE25zFg7MRcyTV8kqpeVYTAlPIf7+BjsUp9QwL6tWxtP/pCIKYCafvhdyPr3J+pZY+KcXMtShAx4oWRqg2505K/RoOheVp9lMz0S756Pepc83SjYMy/k5xnXMVnpsswyWjTLnvhOFV/zxT8x+Cltt7zJFGWuUv72YFezm9hI8+aRmxULmInO9GL8XDHzUiMx09X8zts6J5fbgWCdKN/pC5HPubvG5MSiREcXJHzX3w2T7g5Cvm+01DIwkaK88ZnZ3fE+0ClkZs8DDblAQbtH19925BrCEoEBqhnagoPwjeJtMcdvBzV15c6nR6mU/hdciFH8V8b7FkuNjg59yk8UFtfF6KS5B8KKsjCCISjSUdjjy3l5+BW3vXx1T+lYeioEleM+QlhRm8zrVZakUHCcnQmbh/6WnnUcrImJ2B/Jyb79a3CBay1SA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS0PR12MB7726.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(376014)(7416014)(1800799024);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Q6vqjrh+WHB//ZsVEZXnUAayTkj9GiPFJL+U6P349cRtU/SyfNB8b1R5gHI2Wzyexm+4Gv+jyxECEvduJX6Fqpuu8HOV672p3Nb9AnPtJm34s7oNFZqv3xGu3uV79KwNvJ0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HTHBKfjW821pjGegizkstB2maF10J0Pe2rpbbOJ5KjwGLMsEQe7HiTCdA8ljpbaNWWBjLCizoZlikkAUVVeeMJYysBdCe7RvLoUJAeF5ys+wkyAC9PWTXOaRcA6kVlNhZ/DepvwXhk+WXbDJ16XscCp19y7efUDzS7/UbbEsC7+txEYIUsFrq6QVAX+4+VhmzLxcdj97MhUmX7msZAwQ2uvzN3Pe4Z2HLTS4LblqAVDZ2LpWBS5isGnyyIA24nMiY9S77msX9K1wkAp95h2gZ5xg2mUZkWo/TzO3mo0eQA1DOHRydWTCT+DaG8CO0Ql3Ph7tFwscEc3L34lS7LObnPa8Sr7Kn5Ux3dknXb2KCH0fi2HazQtl/rxbaX2ajSdQRQN7R X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6b039b55-0ef5-4bc4-9156-08dc9643d799 X-MS-Exchange-CrossTenant-AuthSource: DS0PR12MB7726.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jun 2024 00:55:30.6569 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: VuWJDxp6+7nYY5svXEl2hLOznerYxZwhAA4zUAMkMysQR00FTjk9Tc97SgBPurJYsZlPoV5tjwp6kiUwjYi3iQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB6183 X-Rspam-User: X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 67D30180007 X-Stat-Signature: odn4xf1pmbdtdxppxmkihpe7rtwbpkgu X-HE-Tag: 1719449820-783892 X-HE-Meta: U2FsdGVkX19RavooBIzfkx2+g+vP0hWCQGfi/PeVzdKJRI3kkEdb9cVnTgjuI7P10wGTQ6lLHKrYO8N2+P4om8eRWpzVRT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zHAlF93vjwzryi4ruwvsOvRWbeieu6t5YssJVAYmVkd8V7EQAQ3ioer1Gl8wKgBpCEfF4yptSlP6qclLEtM= 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: Now that DAX is managing page reference counts the same as normal pages there are no callers for vmf_insert_pXd functions so remove them. Signed-off-by: Alistair Popple --- include/linux/huge_mm.h | 2 +- mm/huge_memory.c | 165 +----------------------------------------- 2 files changed, 167 deletions(-) diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h index 9207d8e..0fb6bff 100644 --- a/include/linux/huge_mm.h +++ b/include/linux/huge_mm.h @@ -37,8 +37,6 @@ int change_huge_pmd(struct mmu_gather *tlb, struct vm_area_struct *vma, pmd_t *pmd, unsigned long addr, pgprot_t newprot, unsigned long cp_flags); -vm_fault_t vmf_insert_pfn_pmd(struct vm_fault *vmf, pfn_t pfn, bool write); -vm_fault_t vmf_insert_pfn_pud(struct vm_fault *vmf, pfn_t pfn, bool write); vm_fault_t dax_insert_pfn_pmd(struct vm_fault *vmf, pfn_t pfn, bool write); vm_fault_t dax_insert_pfn_pud(struct vm_fault *vmf, pfn_t pfn, bool write); diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 5191f91..de39af4 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -1111,97 +1111,6 @@ vm_fault_t do_huge_pmd_anonymous_page(struct vm_fault *vmf) return __do_huge_pmd_anonymous_page(vmf, &folio->page, gfp); } -static void insert_pfn_pmd(struct vm_area_struct *vma, unsigned long addr, - pmd_t *pmd, pfn_t pfn, pgprot_t prot, bool write, - pgtable_t pgtable) -{ - struct mm_struct *mm = vma->vm_mm; - pmd_t entry; - spinlock_t *ptl; - - ptl = pmd_lock(mm, pmd); - if (!pmd_none(*pmd)) { - if (write) { - if (pmd_pfn(*pmd) != pfn_t_to_pfn(pfn)) { - WARN_ON_ONCE(!is_huge_zero_pmd(*pmd)); - goto out_unlock; - } - entry = pmd_mkyoung(*pmd); - entry = maybe_pmd_mkwrite(pmd_mkdirty(entry), vma); - if (pmdp_set_access_flags(vma, addr, pmd, entry, 1)) - update_mmu_cache_pmd(vma, addr, pmd); - } - - goto out_unlock; - } - - entry = pmd_mkhuge(pfn_t_pmd(pfn, prot)); - if (pfn_t_devmap(pfn)) - entry = pmd_mkdevmap(entry); - if (write) { - entry = pmd_mkyoung(pmd_mkdirty(entry)); - entry = maybe_pmd_mkwrite(entry, vma); - } - - if (pgtable) { - pgtable_trans_huge_deposit(mm, pmd, pgtable); - mm_inc_nr_ptes(mm); - pgtable = NULL; - } - - set_pmd_at(mm, addr, pmd, entry); - update_mmu_cache_pmd(vma, addr, pmd); - -out_unlock: - spin_unlock(ptl); - if (pgtable) - pte_free(mm, pgtable); -} - -/** - * vmf_insert_pfn_pmd - insert a pmd size pfn - * @vmf: Structure describing the fault - * @pfn: pfn to insert - * @write: whether it's a write fault - * - * Insert a pmd size pfn. See vmf_insert_pfn() for additional info. - * - * Return: vm_fault_t value. - */ -vm_fault_t vmf_insert_pfn_pmd(struct vm_fault *vmf, pfn_t pfn, bool write) -{ - unsigned long addr = vmf->address & PMD_MASK; - struct vm_area_struct *vma = vmf->vma; - pgprot_t pgprot = vma->vm_page_prot; - pgtable_t pgtable = NULL; - - /* - * If we had pmd_special, we could avoid all these restrictions, - * but we need to be consistent with PTEs and architectures that - * can't support a 'special' bit. - */ - BUG_ON(!(vma->vm_flags & (VM_PFNMAP|VM_MIXEDMAP)) && - !pfn_t_devmap(pfn)); - BUG_ON((vma->vm_flags & (VM_PFNMAP|VM_MIXEDMAP)) == - (VM_PFNMAP|VM_MIXEDMAP)); - BUG_ON((vma->vm_flags & VM_PFNMAP) && is_cow_mapping(vma->vm_flags)); - - if (addr < vma->vm_start || addr >= vma->vm_end) - return VM_FAULT_SIGBUS; - - if (arch_needs_pgtable_deposit()) { - pgtable = pte_alloc_one(vma->vm_mm); - if (!pgtable) - return VM_FAULT_OOM; - } - - track_pfn_insert(vma, &pgprot, pfn); - - insert_pfn_pmd(vma, addr, vmf->pmd, pfn, pgprot, write, pgtable); - return VM_FAULT_NOPAGE; -} -EXPORT_SYMBOL_GPL(vmf_insert_pfn_pmd); - vm_fault_t dax_insert_pfn_pmd(struct vm_fault *vmf, pfn_t pfn, bool write) { struct vm_area_struct *vma = vmf->vma; @@ -1280,80 +1189,6 @@ static pud_t maybe_pud_mkwrite(pud_t pud, struct vm_area_struct *vma) return pud; } -static void insert_pfn_pud(struct vm_area_struct *vma, unsigned long addr, - pud_t *pud, pfn_t pfn, bool write) -{ - struct mm_struct *mm = vma->vm_mm; - pgprot_t prot = vma->vm_page_prot; - pud_t entry; - spinlock_t *ptl; - - ptl = pud_lock(mm, pud); - if (!pud_none(*pud)) { - if (write) { - if (pud_pfn(*pud) != pfn_t_to_pfn(pfn)) { - WARN_ON_ONCE(!is_huge_zero_pud(*pud)); - goto out_unlock; - } - entry = pud_mkyoung(*pud); - entry = maybe_pud_mkwrite(pud_mkdirty(entry), vma); - if (pudp_set_access_flags(vma, addr, pud, entry, 1)) - update_mmu_cache_pud(vma, addr, pud); - } - goto out_unlock; - } - - entry = pud_mkhuge(pfn_t_pud(pfn, prot)); - if (pfn_t_devmap(pfn)) - entry = pud_mkdevmap(entry); - if (write) { - entry = pud_mkyoung(pud_mkdirty(entry)); - entry = maybe_pud_mkwrite(entry, vma); - } - set_pud_at(mm, addr, pud, entry); - update_mmu_cache_pud(vma, addr, pud); - -out_unlock: - spin_unlock(ptl); -} - -/** - * vmf_insert_pfn_pud - insert a pud size pfn - * @vmf: Structure describing the fault - * @pfn: pfn to insert - * @write: whether it's a write fault - * - * Insert a pud size pfn. See vmf_insert_pfn() for additional info. - * - * Return: vm_fault_t value. - */ -vm_fault_t vmf_insert_pfn_pud(struct vm_fault *vmf, pfn_t pfn, bool write) -{ - unsigned long addr = vmf->address & PUD_MASK; - struct vm_area_struct *vma = vmf->vma; - pgprot_t pgprot = vma->vm_page_prot; - - /* - * If we had pud_special, we could avoid all these restrictions, - * but we need to be consistent with PTEs and architectures that - * can't support a 'special' bit. - */ - BUG_ON(!(vma->vm_flags & (VM_PFNMAP|VM_MIXEDMAP)) && - !pfn_t_devmap(pfn)); - BUG_ON((vma->vm_flags & (VM_PFNMAP|VM_MIXEDMAP)) == - (VM_PFNMAP|VM_MIXEDMAP)); - BUG_ON((vma->vm_flags & VM_PFNMAP) && is_cow_mapping(vma->vm_flags)); - - if (addr < vma->vm_start || addr >= vma->vm_end) - return VM_FAULT_SIGBUS; - - track_pfn_insert(vma, &pgprot, pfn); - - insert_pfn_pud(vma, addr, vmf->pud, pfn, write); - return VM_FAULT_NOPAGE; -} -EXPORT_SYMBOL_GPL(vmf_insert_pfn_pud); - /** * dax_insert_pfn_pud - insert a pud size pfn backed by a normal page * @vmf: Structure describing the fault