From mboxrd@z Thu Jan 1 00:00:00 1970 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 F3590D6EC0B for ; Fri, 29 Nov 2024 13:59:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 62FB56B0082; Fri, 29 Nov 2024 08:59:32 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 5DF206B0083; Fri, 29 Nov 2024 08:59:32 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 431766B0085; Fri, 29 Nov 2024 08:59:32 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 1FDF36B0082 for ; Fri, 29 Nov 2024 08:59:32 -0500 (EST) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 99054140DAF for ; Fri, 29 Nov 2024 13:59:31 +0000 (UTC) X-FDA: 82839289890.30.7803E25 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by imf21.hostedemail.com (Postfix) with ESMTP id 7F13C1C0012 for ; Fri, 29 Nov 2024 13:59:12 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=LReitMhT; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=QLpSmOaH; dmarc=pass (policy=reject) header.from=oracle.com; arc=pass ("microsoft.com:s=arcselector10001:i=1"); spf=pass (imf21.hostedemail.com: domain of lorenzo.stoakes@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=lorenzo.stoakes@oracle.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1732888760; a=rsa-sha256; cv=pass; b=Mbzw2Z6FCjy4Ncyj3MOngoxwN3FlIwpBWn7PgeicHkewIqTXvrUZdaBCZaa2KZgFneZM7b /qNZyJptOLf3Nbo3WLyYnletrgLeAYqOAQbIaVZgQeVelFvLf82Vb4jONsgw041JEVHur3 UJBTZ8YBr+AyOIcbvfVW3NF4BLX73RY= ARC-Authentication-Results: i=2; imf21.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=LReitMhT; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=QLpSmOaH; dmarc=pass (policy=reject) header.from=oracle.com; arc=pass ("microsoft.com:s=arcselector10001:i=1"); spf=pass (imf21.hostedemail.com: domain of lorenzo.stoakes@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=lorenzo.stoakes@oracle.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1732888760; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=P4MUM+qG1Asm4yfPNfNXyfS1VYLtnRlAmjSxa0RDT8g=; b=uFfK7qB1ktvS3WKI+TZW2AGGTFmTH3tO4MTk3tqRMq+s0B8ptzun2yFoIwNsRLLFKPjhzG w64+YHbenzk5dMtfWiHW1DRs1cxzqEWsyq17av0o9VHezP74bLTjJPCWbHiHmhrNnRoKgg 868eWjxHBgDDawTMsYLg++dHFkQ47Rc= Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4ATDff0M001103; Fri, 29 Nov 2024 13:59:14 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-type:date:from:in-reply-to:message-id:mime-version :references:subject:to; s=corp-2023-11-20; bh=P4MUM+qG1Asm4yfPNf NXyfS1VYLtnRlAmjSxa0RDT8g=; b=LReitMhTpcEMT+44cwys5TvGzbEfm75hka azPCFSEwRsBbNLS6EJ1VGlPHI1ntDhOYurUAtKJ9rd+dzm6G0HcQlm0psQi7Enrq ijZIeMV8rjMsZ/CSTRFr35CUH7v9Uk5rudycSn0fHzf6f1P4+UjNYoVV20mNfI5D S30JmYCxOapiUC8WZC7NYq4XGLoSuLRJW+pi79CTSU6dpxhpwFhYz0MTGzYkuQ32 S1H2Jk+U1hYF4NBMtknNvo81GV5anul/TlCTJ5XkrkBjIJvTxGNmwIYe7latyY56 54AsPRzyG6qUfi9CpB5D54yOPBtFWgT1jJeNZt8qoTT9tWZ+f9Jg== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 4366xybd14-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 29 Nov 2024 13:59:14 +0000 (GMT) Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 4ATDPfoX027564; Fri, 29 Nov 2024 13:59:13 GMT Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2040.outbound.protection.outlook.com [104.47.55.40]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 4367056xc9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 29 Nov 2024 13:59:13 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=WuEPpf2ZI7Rd9NKzQfQL1u7+2yLi8MsybOEmdKvrXr3kXd8GlsCv5MnaBe1lkF0rZK0YUlGZfie/OG54rZaIQuuoX+JjMTQwZtlX5VaqknAIEwQ5hgAh4Ir9n/C8sIwkROa1sW+nNOSHgYrK/8vull3kqipxOWY81kEQBitqUsO9ei+FU+CYRmZ28HY44L5wQopz5/Lo/Rl5ZrMDWYmXn80pxk6PDAh220DNug5Jno9PMeEhiRBJC9GUV2eMuDQK7SREtVu9Tmr4IBCM5w0W4kwzsk8WKjCIfYXuCwbLLdgl/sJZWXrZ59zgbFB1uipzWdgRIi0ds/qNgTWScL/u3A== 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=P4MUM+qG1Asm4yfPNfNXyfS1VYLtnRlAmjSxa0RDT8g=; b=IHUSZr4IIMzjmv5RoLwkVFe2AsTvvfi4UEm3HeQzZ4mABAALm/ctJ8HNle/JN4d8vDhCrmrqzhhf3y4SjYSE7bX9FAdVX6daC78Fyo9l5XZd48JTidP+dN4j8y6PAkiWRc0NpRBCP+hmo7VwlwdtwA80U3SinicNSU47lPls4dNQBstAlcUqtcJ/RbnrkyILDew3QC0gPG99Vl0ef4jQxP27AgyzOCbAPRkNok453uLdn8ZYIjNJJ+rh94ewR56DmeT6D96XCrq4XcKvHohW4hBPIB8v6PHLlst4T01GvSthgIbVEAz9XCaBmalgvWoXAtkedJuV4xV0Z/AdW1ueqA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=P4MUM+qG1Asm4yfPNfNXyfS1VYLtnRlAmjSxa0RDT8g=; b=QLpSmOaHP1b+wW+s/JIOG5EGqVm4O0eA0kGVn+vk2rSC/2CsoxWV/TPalrciv/lBrmdIRLT0G9Lpsh+k92tRvYy0LfqBblqGBxDCdRtV6YxMzeI28NGY+CaYCmlnoFMxxXUdKKk9Lj3h2exU8iNJqxPM0zVZSp3RD2JfjMMyeA4= Received: from BYAPR10MB3366.namprd10.prod.outlook.com (2603:10b6:a03:14f::25) by SN7PR10MB6450.namprd10.prod.outlook.com (2603:10b6:806:2a1::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.13; Fri, 29 Nov 2024 13:59:11 +0000 Received: from BYAPR10MB3366.namprd10.prod.outlook.com ([fe80::baf2:dff1:d471:1c9]) by BYAPR10MB3366.namprd10.prod.outlook.com ([fe80::baf2:dff1:d471:1c9%7]) with mapi id 15.20.8207.010; Fri, 29 Nov 2024 13:59:10 +0000 Date: Fri, 29 Nov 2024 13:59:07 +0000 From: Lorenzo Stoakes To: David Hildenbrand Cc: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Kan Liang , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Matthew Wilcox Subject: Re: [PATCH] perf: map pages in advance Message-ID: <14895682-a013-419f-bee8-1476540ddedd@lucifer.local> References: <20241129122624.GH24400@noisy.programming.kicks-ass.net> <74be541b-22ad-42b5-b3c5-79b201e28f04@redhat.com> <9d6be5bd-ffb9-4a27-b56d-521cf6b7486e@redhat.com> <6cab3e8a-dff7-41d1-af22-f18b8f2820dc@lucifer.local> <94dabe57-232b-4a21-b2cf-bcfbda75c881@lucifer.local> <6795cc9a-6230-431f-b089-7909f7bc4f30@redhat.com> <60191c97-dce2-4a92-8b47-c402478ba336@lucifer.local> <9d4ef1a2-11fb-455f-8b37-954215bf25d2@redhat.com> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9d4ef1a2-11fb-455f-8b37-954215bf25d2@redhat.com> X-ClientProxiedBy: LO4P123CA0169.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:18a::12) To BYAPR10MB3366.namprd10.prod.outlook.com (2603:10b6:a03:14f::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR10MB3366:EE_|SN7PR10MB6450:EE_ X-MS-Office365-Filtering-Correlation-Id: e42db7d5-0eac-42bf-7f6c-08dd107dffd2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|366016|7416014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?Y5JXlMD15eczRf6rtf94WYbv/3rZloKBOzoMlA0vyTYo++q7ssMLWZoFadKt?= =?us-ascii?Q?CH8AfV+mhbQwbA8VmxzzyvNOE0fgIzpmZj0z6UCLDbD73evyLjZAaEzktIDi?= =?us-ascii?Q?kOmG8hlyVfrs/1mhxGW5DZdxC43L87oxadPeuQTPi22hF2vIKUtXuRj7hoB4?= =?us-ascii?Q?QY9Eg9qXBt0ZC1Jc/AKXTgYiNX3pWV0bjEG5nAcSvkcdYBbamAA0ChROiWR8?= =?us-ascii?Q?vfWOxeSoPKddWRqgDIfMJSw8CMB4QXOx0ylgFLy2hRXvX1vGYNq8MGKUg0sD?= =?us-ascii?Q?5hz5w84iqJH4zuj1LEezwbmI+e2YubCQAfehzNOFJOuRsAQ/FVLq+WXmTskY?= =?us-ascii?Q?aK/1/w702A2tc+fxjzfqdWipJxiNEW6oC+LLZKa7XlrSt9a29Cecfdah9Uix?= =?us-ascii?Q?ZDhme16nPNC44JWOZO4gx3yNmHMGCJg6RdIgX4Yjq3KzARPlq8ONXq3ta0cx?= =?us-ascii?Q?52DSEVBs6Ip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X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR10MB3366.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(376014)(366016)(7416014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?MlrQQHUJTf6O8mKeXbW0GvvpOE7t3bZGDwcF8aNDJLh+tQkk0uv+pYhHUyXR?= =?us-ascii?Q?DAmTI0zTPMbH9n1MIDHML4xOruKQo+ysUpDopGZBu+JG1fnjewMslVLeUkhe?= =?us-ascii?Q?knEmu8MFBOWntU5GMcWxHeiv9vhWzSp/JHGDPGd7j38fxCMpkhVIMmW6zTeP?= =?us-ascii?Q?gDAx9ErygHyPnJ7j/LJWrD4RxGtUukEqVoUVKZF0tDWhN6BnMlnwY8PjI1de?= =?us-ascii?Q?QzFkSRUkZjhlKxFMZXUBKZp5xSHF6ydDO/H62fQDndHqFf8Rxzrc93NRLdv1?= =?us-ascii?Q?5Cy6Nc3tCilVqX33Myvqy0u1eqr4JnP2SqxfL7NaYGlV0AqRSOpGr55MaCOf?= =?us-ascii?Q?+crtzhEetY4kVB2nTrrpogvzBup80ltQL+JrCbZOpNBwtzih/Y25EmhbEXeo?= =?us-ascii?Q?gr4NL4/fQfLX53ZSDjDNHRKMExVHbAHiq4g/GQ60cR+ce+qLLn91kAaXBjct?= =?us-ascii?Q?0Va6QOTmYgAAy6SYDMZTl2r0X82LaWOx/KXPTT3HcebsLl+Ygaezg0IsE/0f?= =?us-ascii?Q?0UCu4UW2iRWKdalwr85/Pb5pMQd2fybDURq58OZgNKoRqKHj4PWiB2CfaCvL?= =?us-ascii?Q?FnWfqxq44aou3yVxRsxJ7H7xwLUzrx7Vr6I/pzQcwmSqaVx20xSvPGmotUdj?= =?us-ascii?Q?TK/pUn9/fwHYHKXYuCjo/+VhkQQcAyOD0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?TLWpbHHabe9bSofywZ+AWwT/omeoF9ecwd6gRsiHHjUgp/zxzZfInM+esLdQ?= =?us-ascii?Q?zA=3D=3D?= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: EQopIPnxoz5YlPYVPkMZHYlq6MRSr4cfgosvI3lcqTTBl43jfar9vr+liSMJNu6wHjtTl85hSTpsD73QE/c+gTrgU+8duL6m0gPEoiiD3Q7l0Y6vDefUgmkRabgPWdaMjsHVsIyw9iZyjD9yOtUJAMjeA6Kgi4ALIRWNBMQPvH5FeGf+h68vR2EACrIcm3wPdMzAbszHaCShdU33Z4+pkKP7J1lxvgbak8t973NIsAq6+6RcX5CKTBXgNsTPlxxaDlUPQmTMAEp6g0wwQGL7eOy2tOQoI1qkglKyzSjkWufb5RbtLOksExJa8RZjCorI1XNJe3i5z13bIcpD9qoYluBvF+itY3FkwzQPhWjJ+IlT7F/sSbjWeWN3NQtAYTV3Ft6i8K+KatDj6ESBogVt4PaeHPGPlZpaU+490yE9PjdSGxZkmCLQS4LZ8tNQKeQmMzE/PrWj4lOb2BsZWABc20vMKpZ9lO/RXrQ/Y1eFmUbTQmZYtRxR3Iw8qOKeMvRtgMDc+IaMqrWJuQa/TMZDf3o9x+3yYp70ree/e+7m/bHnbaW1OHhq9NVt2Ar04VkAZkJlYZN2P9oeyeHnnbHoYYFhQSrbnEBSeKYhUl4OC7k= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: e42db7d5-0eac-42bf-7f6c-08dd107dffd2 X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3366.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Nov 2024 13:59:10.7999 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: zTP86aR4C0rTGYCHkWEfBQWd8cBf8FcLfXngPZTYeFGsZw8ijXPpkWWF3J0Iyr0c4R8SsUQQ9QeFavu6VKkN6UXPldQgb7gw4SwdIMkx1yA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR10MB6450 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2024-11-29_12,2024-11-28_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 adultscore=0 suspectscore=0 mlxscore=0 phishscore=0 spamscore=0 bulkscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2411120000 definitions=main-2411290114 X-Proofpoint-ORIG-GUID: zyxLlvz-71WtVkGy5EoPzY43NS6m84X8 X-Proofpoint-GUID: zyxLlvz-71WtVkGy5EoPzY43NS6m84X8 X-Stat-Signature: 4a8d5awn75tn5yxyt5ghtg6e97qhrrt1 X-Rspam-User: X-Rspamd-Queue-Id: 7F13C1C0012 X-Rspamd-Server: rspam08 X-HE-Tag: 1732888752-904069 X-HE-Meta: U2FsdGVkX1+B9f8ERGuT9AYAN1Doz9QSS9tNb5OAAfLauXrFDIWVBRj9/kz0nEqO3IwhjiMah3S1W4gUr5NoqUTIDqE2NNZUJLMmbTbY9PdWYgTRo/yRkAJFvx1TXtbRQF9uD/zYXCcNnffHFW7CcPIoDapCr5FHNWIvSr2YB1X9z1JPcXszi26y6Yz6XPzlE4cyHWqSPsv+CaG0CcPU7Zfn1C+4Jmi0E/NgJvYujQL5L+eOOPWAI+DoMPEvb57IbyZYOCkIxA+E9DFkW9/IEr+p0sCZDXaADrg+dkRACzO1+B2nE7ZXw3EZblkz0AboacDzrASwp/Ktfz/Qna37r/84jYhhgPbsUCEd85o5whGRF4O+QlD5GAptMRrxlr9W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1eb078Nao1k7kecfuwEb0vHxtRVAKd3rr0/dd+qI0/ZNPluDgP0/mdbIswn52bnHLcfWhWNC96Z3JUwu7Zb97D7/wxCKycqLSntj2iAR98jQc+ExmBp1fgz2aIKQADYLW5JCujpB1 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: On Fri, Nov 29, 2024 at 02:47:59PM +0100, David Hildenbrand wrote: > On 29.11.24 14:38, Lorenzo Stoakes wrote: > > On Fri, Nov 29, 2024 at 02:24:24PM +0100, David Hildenbrand wrote: > > > On 29.11.24 14:19, Lorenzo Stoakes wrote: > > > > On Fri, Nov 29, 2024 at 02:12:23PM +0100, David Hildenbrand wrote: > > > > > On 29.11.24 14:02, Lorenzo Stoakes wrote: > > > > > > On Fri, Nov 29, 2024 at 01:59:01PM +0100, David Hildenbrand wrote: > > > > > > > On 29.11.24 13:55, Lorenzo Stoakes wrote: > > > > > > > > On Fri, Nov 29, 2024 at 01:45:42PM +0100, David Hildenbrand wrote: > > > > > > > > > On 29.11.24 13:26, Peter Zijlstra wrote: > > > > > > > > > > On Fri, Nov 29, 2024 at 01:12:57PM +0100, David Hildenbrand wrote: > > > > > > > > > > > > > > > > > > > > > Well, I think we simply will want vm_insert_pages_prot() that stops treating > > > > > > > > > > > these things like folios :) . *likely* we'd want a distinct memdesc/type. > > > > > > > > > > > > > > > > > > > > > > We could start that work right now by making some user (iouring, > > > > > > > > > > > ring_buffer) set a new page->_type, and checking that in > > > > > > > > > > > vm_insert_pages_prot() + vm_normal_page(). If set, don't touch the refcount > > > > > > > > > > > and the mapcount. > > > > > > > > > > > > > > > > > > > > > > Because then, we can just make all the relevant drivers set the type, refuse > > > > > > > > > > > in vm_insert_pages_prot() anything that doesn't have the type set, and > > > > > > > > > > > refuse in vm_normal_page() any pages with this memdesc. > > > > > > > > > > > > > > > > > > > > > > Maybe we'd have to teach CoW to copy from such pages, maybe not. GUP of > > > > > > > > > > > these things will stop working, I hope that is not a problem. > > > > > > > > > > > > > > > > > > > > Well... perf-tool likes to call write() upon these pages in order to > > > > > > > > > > write out the data from the mmap() into a file. > > > > > > > > > > > > > > > > I'm confused about what you mean, write() using the fd should work fine, how > > > > > > > > would they interact with the mmap? I mean be making a silly mistake here > > > > > > > > > > > > > > write() to file from the mmap()'ed address range to *some* file. > > > > > > > > > > > > > > > > > > > Yeah sorry my brain melted down briefly, for some reason was thinking of read() > > > > > > writing into the buffer... > > > > > > > > > > > > > This will GUP the pages you inserted. > > > > > > > > > > > > > > GUP does not work on PFNMAP. > > > > > > > > > > > > Well it _does_ if struct page **pages is set to NULL :) > > > > > > > > > > Hm? :) > > > > > > > > > > check_vma_flags() unconditionally refuses VM_PFNMAP. > > > > > > > > Ha, funny with my name all over git blame there... ok yup missed this, the > > > > vm_normal_page() == NULL stuff must but for mixed map (and those other weird > > > > cases I think you can get0... > > > > > > > > Well good. Where is write() invoking GUP? I'm kind of surprised it's not just > > > > using uaccess? > > > > > > > > One thing to note is I did run all the perf tests with no issues whatsoever. You > > > > would _think_ this would have come up... > > > > > > > > I'm editing some test code to explicitly write() from the buffer anyway to see. > > > > I just tested it and write() works fine, it uses uaccess afaict as part of the > > lib/iov_iter.c code: > > > > generic_perform_write() > > -> copy_folio_from_iter_atomic() > > -> copy_page_from_iter_atomic() > > -> __copy_from_iter() > > -> copy_from_user_iter() > > -> raw_copy_from_user() > > -> copy_user_generic() > > -> [uaccess asm] > > > > Ah yes. O_DIRECT is the problematic bit I suspect, which will use GUP. > > Ptrace access and friends should also no longer work on these pages, likely > that's tolerable. Yeah Peter can interject if not, but I'd be _very_ surprised if anybody expects to be able to ptrace perf counter mappings in another process (it'd be kind of totally insane to do that anyway since it's a ring buffer that needs special handing anyway). > > > > > > > > > If we can't do pfnmap, and we definitely can't do mixedmap (because it's > > > > basically entirely equivalent in every way to just faulting in the pages as > > > > before and requires the same hacks) then I will have to go back to the drawing > > > > board or somehow change the faulting code. > > > > > > > > This really sucks. > > > > > > > > I'm not quite sure I even understand why we don't allow GUP used _just for > > > > pinning_ on VM_PFNMAP when it is -in effect- already pinned on assumption > > > > whatever mapped it will maintain the lifetime. > > > > > > > > What a mess... > > > > > > Because VM_PFNMAP is dangerous as hell. To get a feeling for that (and also why I > > > raised my refcounting comment earlier) just read recent: > > > > > > commit 79a61cc3fc0466ad2b7b89618a6157785f0293b3 > > > Author: Linus Torvalds > > > Date: Wed Sep 11 17:11:23 2024 -0700 > > > > > > mm: avoid leaving partial pfn mappings around in error case > > > As Jann points out, PFN mappings are special, because unlike normal > > > memory mappings, there is no lifetime information associated with the > > > mapping - it is just a raw mapping of PFNs with no reference counting of > > > a 'struct page'. > > > > > > > I'm _very_ aware of this, having worked extensively on things around this kind > > of issue recently (was a little bit involved with the above one too :), and > > explicitly zap on error in this patch to ensure we leave no broken code paths. > > > > I agree it's horrible, but we need to have a way of mapping this memory without > > having to 'trick' the faulting mechanism to behave correctly. > > What's completely "surprising" to me is, if there is no page_mkwrite, but > the VMA is writable, then just map the PTE writable ... I've had a number of surprises on this journey :) To make sure I understand what you mean do you mean the whole: do_wp_page() -> wp_page_shared() -> if (page_mkwrite) { ... } else { wp_page_reuse(); } -> wp_page_reuse() -> maybe_mkwrite() [hey VM_WRITE is set, so yes make writable!] Path? Yes this surprised me too... so you can't just say 'hey map this read-only' and get what you want, because the kernel thinks it's somehow spuriously read-only mapped and just needs correction (probably there are situations where this is necessary). It has to be explicitly CoW in VMA flags or implement page_mkwrite() (or if !vm_normal_page() then pfn_mkwrite(). You aren't saved with !vm_normal_page() mappings either without a pfn_mkwrite() because: do_wp_page() -> wp_pfn_shared() -> if (pfn_mkwrite) { ... } else { wp_page_reuse() } etc. So it's the only game in town... > > > > > At least in perf's case, we're safe, because we ref count in open/close of VMA's. > > > > This is a special case due to the R/W, R/O thing. > > > > In reference to that - you said in another email about mapping one part as a > > separate R/W VMA and another as a separate R/O VMA, problem is all of the perf > > code is set up with its own reference counting mechanism and it's not allowed to > > split/merge etc., so we'd have to totally rework all of that to make that work > > and correctly refcount things. > > > > It'd be a big task. I don't think that's a reasonable thing to put effort into > > at this time... > > > > Also who knows if there's somebody, somewhere who _relies_ somehow on this being > > a single mapping... > > The main issue here really is that we allow R/O pages in VM_WRITE VMAs, and > want to make write faults fail :( > > What an absolute mess, yeah, without some more core changes > vm_insert_pages() cannot be used, unfortunately. Yes indeed, sadly. Maybe an idea for a series, as memdesc's are at the very least a long way away. > > -- > Cheers, > > David / dhildenb > So overall - given all the above and the fact that the alternatives are _even worse_ (having to spuriously folio lock if that'll even work, totally unnecessary and semantically incorrect folio-fication or a complete rework of mapping) - while you might be sicked by this use of the VM_PFNMAP - are you ok with the patch, all things considered? :)