Message ID | 0b56d4b4da706ef6e7194b1776fda54ed4c21599.1736221254.git-series.apopple@nvidia.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> 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 B6650E77197 for <linux-mm@archiver.kernel.org>; Tue, 7 Jan 2025 03:45:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 07CDB6B00B8; Mon, 6 Jan 2025 22:45:27 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 005F46B00B9; Mon, 6 Jan 2025 22:45:26 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D4BCF6B00BA; Mon, 6 Jan 2025 22:45:26 -0500 (EST) 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 AFA276B00B8 for <linux-mm@kvack.org>; Mon, 6 Jan 2025 22:45:26 -0500 (EST) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 6B08E1201F4 for <linux-mm@kvack.org>; Tue, 7 Jan 2025 03:45:26 +0000 (UTC) X-FDA: 82979265852.26.9E497AB Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2042.outbound.protection.outlook.com [40.107.220.42]) by imf14.hostedemail.com (Postfix) with ESMTP id ADFD2100005 for <linux-mm@kvack.org>; Tue, 7 Jan 2025 03:45:23 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=lEf0PGGh; spf=pass (imf14.hostedemail.com: domain of apopple@nvidia.com designates 40.107.220.42 as permitted sender) smtp.mailfrom=apopple@nvidia.com; arc=pass ("microsoft.com:s=arcselector10001:i=1"); dmarc=pass (policy=reject) header.from=nvidia.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1736221523; 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=LHF9yIYFSBkDrWWm5Q2w+o+FZwVZ6F3GbxhCIiJOiz4=; b=0oqk6m/7t+aZ6K8cJZBuEWI+d6iMX0XycHFeH01icSVpM/Af0FvZY+Rz1Xyu4cauF7XP/9 SdboH0o56Id+ydNJoyPGJDRyGlm71V52DFUvMPgIxDp6nUQAI2hN3k9IoWKain19lctarv ouGQsFEo3DgueDp8Y1sCjl0YDO3q/Ro= ARC-Authentication-Results: i=2; imf14.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=lEf0PGGh; spf=pass (imf14.hostedemail.com: domain of apopple@nvidia.com designates 40.107.220.42 as permitted sender) smtp.mailfrom=apopple@nvidia.com; arc=pass ("microsoft.com:s=arcselector10001:i=1"); dmarc=pass (policy=reject) header.from=nvidia.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1736221523; a=rsa-sha256; cv=pass; b=d/NfT8jzucXX3ekR/2swk6Z5dK+9DkJkqbM4JBJ0xkAc3hKldumFfQW+sI/Esu4y6JC3Ys vfh9H6Zdt+FF8Y4EghLWu4GISOodBlcA3j3lGUuIIaYUKqYX+2yCKDOOFLbP+Su1p4rB00 c2CVI3e52HaghV6QbR26W4lbtk9hc0c= ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=YMyPLKBoE59LIt4G99CZLWJtUoLcwz8sZRsC7lRfIqA1GbIzZitekJUIfdc8QimVspPkUK3tTCZ4GEjc2kPZyWyT4SofOZpjZ6Lufil8Ctgvi8TmUQ9tpwa2j5mcblUz4zls+Wl3iFUNDhEwaBCRjug0xf8KPu+zo+8DQc8wcdy2Tmwxw7xQYGlN97ZF8oJSm9xeAg7Vcitbx980dY9Y3xKReLP+0R4BWjV2GSz2/0iQs3y5NNe6Y+bCFSU+7aaZypobRO/PmUjFGMjzU4j1IK2Sn+BSiT+Wh8nwSYESyYjukNLIdi2zWNy3YT7UDI69QTunNPxxPKWd69qjWsCx3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=LHF9yIYFSBkDrWWm5Q2w+o+FZwVZ6F3GbxhCIiJOiz4=; b=kaR0IJbWAfP8b7v+65Aublafrz1nmYZfTZSiZYE2Pa7ZyBgGwsDEf5xOZH1/AtS1XNk9ibGhXkAaLkRAO+LFqgaTPybkAyZTLY6LKCttVam52bt1DbfmGYlh+Wj464zQOYF11Cm/8Dre3tNeqv41gYE1P439YXvxUKvC/0W3Q6q8azQpGy2bPgqrM1MM81kLXajIhqx5u9BkjUQ+6hOxLRHvUU+gU/XG/zK9me2vub1tXciyYdEUJ4Fo/xmC7RkJSmtsVCPPGp07fK9Qx53GHLRoQtccER7asCV4CIuTaK7nWj6CKcIDTrnUOTB8Mp4aZzZO/IEsx8V6Wxths4yGpA== 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=LHF9yIYFSBkDrWWm5Q2w+o+FZwVZ6F3GbxhCIiJOiz4=; b=lEf0PGGhdWJbpVwPuBdIJBTTEqJuCdZ3bHLLeqjYTOlo7jBQh2jUXt0hpFWt49FAH7MteuLKLRfYrhx8ECu7Q6cxV5tosoC3eC0UCkHFNaUXLYfq5cCqWUBSkO19N81gtwS6MgfZrGELd7ieVANkkJjCV3w+5BNHJgpOdZH7CwlPLY683QnRQCi/ik0QZzuT+6iS1IT2Vd8NCmU8RSP3q0EjI+lkBxgJJ6GdJiPnals45yz0G7PQLDsbBHUCryhIVRhIGqD03pD5J8QCJPrh6dRqKAwfj4TFBZ6J7dYwuF+MP2I1FOeTvz6W6Bhfwo5jNaObCtn/5LHgikxqAWlaxg== Received: from DS0PR12MB7726.namprd12.prod.outlook.com (2603:10b6:8:130::6) by CY5PR12MB6129.namprd12.prod.outlook.com (2603:10b6:930:27::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8314.15; Tue, 7 Jan 2025 03:43:57 +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.8314.015; Tue, 7 Jan 2025 03:43:57 +0000 From: Alistair Popple <apopple@nvidia.com> To: akpm@linux-foundation.org, dan.j.williams@intel.com, linux-mm@kvack.org Cc: Alistair Popple <apopple@nvidia.com>, lina@asahilina.net, zhang.lyra@gmail.com, gerald.schaefer@linux.ibm.com, vishal.l.verma@intel.com, dave.jiang@intel.com, logang@deltatee.com, bhelgaas@google.com, jack@suse.cz, jgg@ziepe.ca, 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-ext4@vger.kernel.org, linux-xfs@vger.kernel.org, jhubbard@nvidia.com, hch@lst.de, david@fromorbit.com Subject: [PATCH v5 13/25] mm/memory: Add vmf_insert_page_mkwrite() Date: Tue, 7 Jan 2025 14:42:29 +1100 Message-ID: <0b56d4b4da706ef6e7194b1776fda54ed4c21599.1736221254.git-series.apopple@nvidia.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <cover.425da7c4e76c2749d0ad1734f972b06114e02d52.1736221254.git-series.apopple@nvidia.com> References: <cover.425da7c4e76c2749d0ad1734f972b06114e02d52.1736221254.git-series.apopple@nvidia.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SY5P282CA0175.AUSP282.PROD.OUTLOOK.COM (2603:10c6:10:249::26) To DS0PR12MB7726.namprd12.prod.outlook.com (2603:10b6:8:130::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS0PR12MB7726:EE_|CY5PR12MB6129:EE_ X-MS-Office365-Filtering-Correlation-Id: 45555fc8-2d57-4e6f-b271-08dd2ecd83ea X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|376014|1800799024|366016; X-Microsoft-Antispam-Message-Info: mgg21V79Uamq8I6JtrQ0BkO88rPpNdUvjrEYPnCLa6nuLPWaw5mvlUYmb+UrzE1OeWZpTepUrqjZI/ANWyAjew/g+3dysu5rUoeB2g7APfTFu1EA6XwxB5Cw4rO+XIFJ2yzd9K+25Cvug0Kzb5KIdwzwDYBxuYqShCfvoTj7q3xISuqXgp28zQbFA7QX401r/4rCMLgGrZAo6vEMwo4/iGRAR95uBMtxWhQBtM5R0AfGDkJ8Lv3+ytNF3AHWrlC5mmFAPBMrUtu23DrHGIB8QTVPT97Y2w5k0YWjeicUSgLcSxCUblsIW7/3E3xLWm+9ATBggkKhIT1Gx1V2lIEJpZUOEeqmxVOzXud3T3IOJ3Eew6jFVTjT2nsI/J2z60n0niDkyTcl+nn4VdBZdmXSgKiiHwTO84OAujCjBPB5UtymA2KIPb/GtePfxsckZ8hK/+ONeWxPQjJmmAjOGXWiQUYmD62dNgLql/aw33KrQvkjRbdVA7cwwokjUCupvqu86zTQE5VQOBULDCFZkw6Qht4njo5dJNbvHDGyJbOwe239yhnfn3dnrjE4vxa0Ky8s+EmkfI1l+IY6eBWKCStSV8Bfq5UxASCl0aMrNck64ImWUwCpHoJirSioNcthDWFAohjQSUDValTePmyp5D5+o/hTGhnpVCYiuJoFihV5kKegRVOek2Jwj6ZsAIgk98RonKvPul44gvqOjmesHzakf5vcj9xCE8iAOLuoEFaTp6MI/UdbEI/rD+H5RLh+bAbS7gIMVntKgIXEDN68ZjxSFD7We1spBU6f3AfTFeNaT1oA2xJ/aTu4qUKeRwTgjKCMWy6sPDaglG2c1MA8Ag3CgaZxKEfxiSlTWlLPkPkKxpx0SD56ahN2LNWM/6BXroU49hMdc2ufn3yOeATIMrM7KNDhd+3rz/kST4Ym+2EspC4Hp0E05ja8Zitg10pryK+LtRk48eUE/wVQXFT3V7LLwEI37RwmDLcx0+EfjOZOH1oWA8GFik+V5A/qgHkv4qGAYRLzcqRRelHN41pWufotfs7dQd9EGD3m3eGDqTmZoy1SPGWraU2P/iS0nHX2xT3V4SsP3p9lQEPPYvgOwPh/WTnboVdnePKeoKnfRRBxx87io1z/a4ns+J+RBh3ra1KgDrUOlcK8pCVqibuteIaoMgn5RyrxAs5j0VAcZzbpZzbXkWKbq8jN4YioolxKwYhkIwjt5OEx4lBISGznzS1BPU07SLfNp5CRzdqANi49AvSTNXmpk6Ly4j0VtfuehmotR07Avvj1WhRv2A6pA4Z7hwyLcyBWivIXQAveewiDSQdmOAFz7xlT3KQE7QIVCoctzx2r0UB6bxIujLnuT/C/GfMG0TdkvVKgNiLonfmc5gl8ET4o9ev3vi+3GwRoMUVW 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)(7416014)(376014)(1800799024)(366016);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 6+N71Hi6maW9GWlTnZPw2KDaZ4TvS6wYocCN+fz/ssBPyCFTiIlQ2ihJ/VHlXmpMxXBZ9SKnhSWNsz/lPlZjJ6Qcz152z6bOj58Oas7K9ApKn61aQncjn6ikxaOVoo+W84BFiSk1CYTi4ktZ+koNqaYumPxpeWBeICwMEXsCbtpx+fPtgPXvhls7uTqssllKZOHnbbJ/8RK8Q5p6J6pkC68QQQCgA0PERzwFjMB+DkeLzW062E9GFygT6jFIhUhVEiX+j3oKJ7o4Iczs/8IbN3Ycr4xfjRWz0qh0G0avHbgm5eyBEvo6dQzfislqf1Xyah8N7Mo/5PGKdVaghITvqSjxqYa594zv97N4XnL7mJ514a6y8zljVIhhNIvuoH9TLFSux4H0oQ5RGKcBbLIrL33zrYXEycveykTIRvwG/vMXZM2pyr33IoBn0/SHnBKhgovbmlwcMLx0LCfK8UFX1/iZ2Uiplcadh5SoJZEJu4ccMfNNhWNqkv5QXQV3rr3b9KP2FiYkYVrOjlglHa9IiMct/nAKmTAmDSh19NYx9AVrnO6jRoYuFSOR6+OGecmn60UMCByyImmTGkWwx1bECwLVdp8KKgOhR3Dm2AfDXfo4w28aq6+SOmvIplDvxlTgMrNnppzbiO0sujFeWiu4fWb/ChyQe6JzvJftbfT26DNjTSx9zIPtJy6Kh7uzlbsrvFB1J3btKeyEeudKZXsUm83mCgD5B/jTIh79vxs+SNWU+PlQ54ARjRSDccKF1H/y8RQQaQk8rMCn2as36mzMbtZJNTNlzjpxKM6tj/wmWkYQTGtLFXzE202/UaJLLIC4hpI1tHrAwU8cn8bA6Sq1jZqRn7kM9nZpSu6aDaKcOE6ZbNf5kClLRyLIcWwsQDiXIhYerRrbhIUiUA4zbFl/1Rj8QvARQVVfYXHnUpXjNTs12AjcJ/sM25+9RpcT/LqTBUZHVQ3xjxFWrJHUGEinarMyQ49ry5b9AEWzesn+edosnf8+oYev1jOkig5pMOjIadPq4G/Nm9CxGhvuJS4u+mfEx7K9hVeNSd6nT49Q3LSU74D0InIKe4t89rS77HrszXcomfrAziV5CN8/OXPkYpYUSVkyjjRfEiFEVKXuxJ0BtH54JIezPIPEXv5B0YX3ZC9s/MdfomJhReGSb1A4RWW5dAOIgsN2mIMRn+FADKuMFG8+1rXiylblV1vfcSitevABpy8apb36uzkO4kq3/TLzDmbcfjxcXUSEnJ9/uuR8nhoWWimhJmLjvocfB8wdpos3kCk9a5z/EF3l6WIv4tV6eK48gBGvNRnhKPyFitqvoJwpoWpumWQDgC+jhTqsb/mrJw2+aBg5Vv7YHQiKbfzDfe/vUOkREw53+QNIEv1GzBvHm3cuaEnDgAimZePuLKvDxS9I+hFrOZA5+b3Y0Am6jrcUl5NnuKrgBIwD2gSGK8wxkL5ZyhI/nAbuP/NJ/Bx8NOv21Gho+zMceq42+SNNuy5V6PMyuVvZ6sL70iFBMK39rxrN6RA+C++HtIofjK/DqJ36bx4JtimpYPQGNICinF/m4GppLRWJnDAr9uXGDtXTLU0fuM9yEmZf87nR X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 45555fc8-2d57-4e6f-b271-08dd2ecd83ea X-MS-Exchange-CrossTenant-AuthSource: DS0PR12MB7726.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jan 2025 03:43:57.6677 (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: SkOhFE12aQ6VRjI9DQWXrGWvmyf5gntcxUPAzhQFXDMgXinYOB5POqGXcz4De8Nvg6ro2Ep6k+HuFJvmt3R3vg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY5PR12MB6129 X-Rspamd-Queue-Id: ADFD2100005 X-Stat-Signature: 6a6iawqwre3q8pikt4tox9pecfgccqey X-Rspam-User: X-Rspamd-Server: rspam11 X-HE-Tag: 1736221523-843510 X-HE-Meta: U2FsdGVkX18k3FNs3WGZnBv00Fnw+ba9Irf/V/GZjZIIfbeirx+tcg8DwBSoufb0EVFvB6QTAd7pJmZm3MfaOLfZob1nP3namPUf8kCCsQJD3oyUEVX3AGpBqU1ClBtXzwrdh5I4aAV+dgvNT8YU6xfHp00ZDInDtZZuZF+2T4jHkLm7pCcdvZDuEY5MlOUk/26csr77AKwyJsC5pzV8vwJqqc/AKjDMRubVJq5mA+Po7aamZqYRq5FL4S4mSzUxu+QF4ak1QBLO+4lkyLgMTs0znVH5XRLmzg8U6XJz5EdntUo+oecAaE3GLBjsJDxe+uJfMqCHEWhvpofDMeCXL6Xeko0jNnMlE7DekchZn9iYw2r0SCiFyw7zeDn2+Xr2O3+M34yw6vVz5TB4ARRWyUebW3Y7CWOFcnrArUZEr1E9Qcra4CkmmJ4U0Am4UlIL2IM3rG43k9xAUg+FhGRSQbkclAutXOh1HFCzpOAI2+Y0PpZZ8/YQo8nJRzD66qQIk46lwbCWwR4f3v0C/p1ylZVlbBLBrhpJEUsnxLZCXDnyd5VzaK8sBFgiW+eIERYthNazct80S4c4Ebp0jOIZ/MCN8PQ4GvsuBtQ1548JXqaTY/Rc+wrRBZejHXNXdnRCYJBxqJ78OEitheXbVkEMt6ReohVZKXNEGWytzihdrAPAZaZSC+ooAvMNTKkmMvGtI0uXP8o+cLlz4JKfyWViCTV3kjjjy0vQQqeYn7aCYSIKGs5qIp3vp87/IC6QdjSuJEhDbGmZWO7VNtZlyqvbyT99mLWHVnGPZBMiLwoNNlNZ1630C5L1GCWBWf8tLHjSC9+P7ctOixKwXjBS9VR0DsFCRROH0U+q3tei5QUoUK5FeZKco72kEYjxhIA4mRNV49GMI0fEK0PX9+QtlHUOsV2NvjdDnxHsGFvvC9iqjGMJ6szvgBTcm7r6sSBdgapLk1q9AZTc1uQ3TW/legg 6oHYWHde zegBjAmgV0K15rpdRlrgX1w49W72cesaozZxInQxYSrHGNdpG+Zb1E5smh2KiNgn3VO30Cw2CrT2cultI8JK+EPOiB5MxTGe608nyK3K0o35kAhC4JgYR3DphcqL5M/qePK6+ijiH6qcHQOrD71TB+/6o8t/oCtdaz6w/hVKeCSNveTMgugtwYjvBQ/S+0kwE51AVdkzkAKmLH1TDLyjvHPErkLKbmFKc774HpNz+08nBG1RTprI7hv9gFE8Ji9JpSkPTLPnDIFUDnSphVjljooPNs2E2LlGkGhOrskE3YQZGOcQmeT9TXohVDFFe9WSiBjxWTT48uXSEaeORlDsyrZHNpAkZLoTMh0bQzSVCVV/YTBcJcDvD2pkQIqAD59D+2Xi0FDeB+IF+/SUyTvE+45WjLygMHdFFe8dXoOxkpTcCvl3VquxMep6WT4IuThf4urthWqLEFatOHtGmTXfBDvCuEQ== 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: <linux-mm.kvack.org> List-Subscribe: <mailto:majordomo@kvack.org> List-Unsubscribe: <mailto:majordomo@kvack.org> |
Series |
fs/dax: Fix ZONE_DEVICE page reference counts
|
expand
|
diff --git a/include/linux/mm.h b/include/linux/mm.h index e790298..f267b06 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -3620,6 +3620,8 @@ int vm_map_pages(struct vm_area_struct *vma, struct page **pages, unsigned long num); int vm_map_pages_zero(struct vm_area_struct *vma, struct page **pages, unsigned long num); +vm_fault_t vmf_insert_page_mkwrite(struct vm_fault *vmf, struct page *page, + bool write); vm_fault_t vmf_insert_pfn(struct vm_area_struct *vma, unsigned long addr, unsigned long pfn); vm_fault_t vmf_insert_pfn_prot(struct vm_area_struct *vma, unsigned long addr, diff --git a/mm/memory.c b/mm/memory.c index 8531acb..c60b819 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -2624,6 +2624,42 @@ static vm_fault_t __vm_insert_mixed(struct vm_area_struct *vma, return VM_FAULT_NOPAGE; } +vm_fault_t vmf_insert_page_mkwrite(struct vm_fault *vmf, struct page *page, + bool write) +{ + struct vm_area_struct *vma = vmf->vma; + pgprot_t pgprot = vma->vm_page_prot; + unsigned long pfn = page_to_pfn(page); + unsigned long addr = vmf->address; + int err; + + if (addr < vma->vm_start || addr >= vma->vm_end) + return VM_FAULT_SIGBUS; + + track_pfn_insert(vma, &pgprot, pfn_to_pfn_t(pfn)); + + if (!pfn_modify_allowed(pfn, pgprot)) + return VM_FAULT_SIGBUS; + + /* + * We refcount the page normally so make sure pfn_valid is true. + */ + if (!pfn_valid(pfn)) + return VM_FAULT_SIGBUS; + + if (WARN_ON(is_zero_pfn(pfn) && write)) + return VM_FAULT_SIGBUS; + + err = insert_page(vma, addr, page, pgprot, write); + if (err == -ENOMEM) + return VM_FAULT_OOM; + if (err < 0 && err != -EBUSY) + return VM_FAULT_SIGBUS; + + return VM_FAULT_NOPAGE; +} +EXPORT_SYMBOL_GPL(vmf_insert_page_mkwrite); + vm_fault_t vmf_insert_mixed(struct vm_area_struct *vma, unsigned long addr, pfn_t pfn) {
Currently to map a DAX page the DAX driver calls vmf_insert_pfn. This creates a special devmap PTE entry for the pfn but does not take a reference on the underlying struct page for the mapping. This is because DAX page refcounts are treated specially, as indicated by the presence of a devmap entry. To allow DAX page refcounts to be managed the same as normal page refcounts introduce vmf_insert_page_mkwrite(). This will take a reference on the underlying page much the same as vmf_insert_page, except it also permits upgrading an existing mapping to be writable if requested/possible. Signed-off-by: Alistair Popple <apopple@nvidia.com> --- Updates from v2: - Rename function to make not DAX specific - Split the insert_page_into_pte_locked() change into a separate patch. Updates from v1: - Re-arrange code in insert_page_into_pte_locked() based on comments from Jan Kara. - Call mkdrity/mkyoung for the mkwrite case, also suggested by Jan. --- include/linux/mm.h | 2 ++ mm/memory.c | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+)