From patchwork Mon Sep 23 16:03:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Stoakes X-Patchwork-Id: 13809815 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 56CE5CF9C72 for ; Mon, 23 Sep 2024 16:04:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E45556B0099; Mon, 23 Sep 2024 12:04:27 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DF76E6B009A; Mon, 23 Sep 2024 12:04:27 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BD4876B009B; Mon, 23 Sep 2024 12:04:27 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 9684D6B0099 for ; Mon, 23 Sep 2024 12:04:27 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 4CCA2121351 for ; Mon, 23 Sep 2024 16:04:27 +0000 (UTC) X-FDA: 82596475374.13.6AE5FC3 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by imf03.hostedemail.com (Postfix) with ESMTP id D6D652003C for ; Mon, 23 Sep 2024 16:04:23 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=Z3z5Ci3Q; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b="KcZEe/6x"; dmarc=pass (policy=reject) header.from=oracle.com; arc=pass ("microsoft.com:s=arcselector10001:i=1"); spf=pass (imf03.hostedemail.com: domain of lorenzo.stoakes@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=lorenzo.stoakes@oracle.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1727107377; a=rsa-sha256; cv=pass; b=BSe/vxzA236pv9PRs9yvKI1PMEo7957wqbDtw4zdjt2VmEXQps3pGhbuGho7+jskLpOc+X JR6mLp6FwRgpg1UJNTQJ0+SxSW68PiP4V8CdqgydNheUVZFBLSovkrdHt+leHe1mZ1jZ8i DxleNDbGEIGKto9b5DHUsXUTCMcx9x8= ARC-Authentication-Results: i=2; imf03.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=Z3z5Ci3Q; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b="KcZEe/6x"; dmarc=pass (policy=reject) header.from=oracle.com; arc=pass ("microsoft.com:s=arcselector10001:i=1"); spf=pass (imf03.hostedemail.com: domain of lorenzo.stoakes@oracle.com designates 205.220.177.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=1727107377; 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=xZeDwn2PWu8UYuFKltEJq/RpzlHL3GN0BRBf7w2ydCY=; b=R3jsKPvSaTFQunubOiBK+AHqYbNo9cBbFoAOn0lGGjWEa1nussjitJ8FiSmvz7pNg5TnJr E7EEwW8RVZ4I6NJEhrDVo7F0ZsNnKDa5nICSgB9D1HmvXOzChu1Iuvl/2lXkXTYp9tD/7i JaTqMCZqr2tHuDlydAf7SJO7jvqJJJ8= Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 48NFtXhk021790; Mon, 23 Sep 2024 16:04:13 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :content-transfer-encoding:content-type:mime-version; s= corp-2023-11-20; bh=xZeDwn2PWu8UYuFKltEJq/RpzlHL3GN0BRBf7w2ydCY=; b= Z3z5Ci3QvDcARDcbBc84JiKwInr3Yk+/L3MXiNq23BH9MpEzYu+QMtNRrC/YOOIY JM5w3gyCsl3c8+Pjw7ywvbdZzeN2TBJ5aR8ji4pJZlF+UZD2rD/GY2Bc9Ag07RRs cBldrfKK2O7nqvw2CxAHrRGckp0nwJsz+2xPkCpiLmeATzrDs1lnLHSVGcVGXWuu pWF5eZH95sO5kKx7+pwibKmfuTQQKxez9GHOfzXd9sUmL9ClEq4oZMebrq86GvZT RRPZkvw+Y+AIwp7YkqH0DOyJn6Kq9zHHViZIUY3roCMWRrtMRkupATIvTvn6boNz 4YwdaSju1Ywhnrs+OweU6Q== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 41smx32q4a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 23 Sep 2024 16:04:12 +0000 (GMT) Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 48NFUejg000461; Mon, 23 Sep 2024 16:04:12 GMT Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2045.outbound.protection.outlook.com [104.47.55.45]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 41smk7qpkr-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 23 Sep 2024 16:04:11 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Jf6P48mGil8mw3zglHadaQ1SAh5Jh9AA5hDtunb7tdnjjOG1eqvgWHJu3aSHBRjOzXNlSdjVBzgRNKCc3nNRU7HS3J4dypsYiccYHOf1Ynzf7VGIGv3Ffd/ZTUZYm7W4LFo3SU4jPpsopXm3Spn7Rfq6jjh2zleE87qwQJ4w2xCEc+uaK+jEGjYvqh+Qd2rmnok7xElKySrKBa1n3iJN/PwsbdmruUPDl6apd7AW11jqGCY6Nk7qctYU35h/bvbfUCytMGEpziAcO+jH3f0pZACYWfaXuVGQL2Mx6H3D6Vhhcx3L5+/SiUVe3Jbmcjv7CytINbxUhvaWqn9d/nFojg== 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=xZeDwn2PWu8UYuFKltEJq/RpzlHL3GN0BRBf7w2ydCY=; b=qI6JmJ1vlW0LrW5BmmZ5V1jwyQVxyn5YvT5ROBOn9wRMZvN0uJNwS8dX70H0mspLUaIQ8H0NT35juD0jHpBDabpT2/d1CqesruOu3BWGzo896IhGFsPAMamonrdJli7PuKLqGQUfml7wIH9UW8yxllP92kz7JdA+HQmaMJETqz7xm4zY1LKTljzdTbqaN8FBHKXeCRkBqGsxUinHXW2uCtFaOJA7SuDnvjRFJ0K1h0oiSYH/jmnHrveOWhQ0Fgqh397HA3DuiHlu3V7He51KtT6IeEeH4yLbAph1TwVIzHD/XuzzFSpWd1IBX3enwcsAMZoVD61OY9iXCiBA6fWbmw== 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=xZeDwn2PWu8UYuFKltEJq/RpzlHL3GN0BRBf7w2ydCY=; b=KcZEe/6xW9qVLI0n35boO+mUXxmipQY+cGMnj5pr7dFjkq2p6meSz8IzkDmFE6X91T05rQgdI5AVlPcgliQ9S/Uj2lGFGA3DTH7S4lEm5JhRqzRn2uIFboqR5ObB2x+i3BthFTElUVLH7ODjQbsHo+XdTz7QesaEtZGU1KmUgrA= Received: from SJ0PR10MB5613.namprd10.prod.outlook.com (2603:10b6:a03:3d0::5) by DM4PR10MB6744.namprd10.prod.outlook.com (2603:10b6:8:10c::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8005.13; Mon, 23 Sep 2024 16:04:09 +0000 Received: from SJ0PR10MB5613.namprd10.prod.outlook.com ([fe80::4239:cf6f:9caa:940e]) by SJ0PR10MB5613.namprd10.prod.outlook.com ([fe80::4239:cf6f:9caa:940e%5]) with mapi id 15.20.8005.010; Mon, 23 Sep 2024 16:04:09 +0000 From: Lorenzo Stoakes To: Andrew Morton Cc: Vlastimil Babka , "Liam R . Howlett" , Suren Baghdasaryan , Arnd Bergmann , Shakeel Butt , linux-api@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Minchan Kim Subject: [PATCH 2/2] selftests/mm: add test for process_madvise PR_MADV_SELF flag use Date: Mon, 23 Sep 2024 17:03:57 +0100 Message-ID: <07d65076cb1632a67043b70bbcec8e450d5b8fb7.1727106751.git.lorenzo.stoakes@oracle.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: References: X-ClientProxiedBy: LO4P123CA0640.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:296::21) To SJ0PR10MB5613.namprd10.prod.outlook.com (2603:10b6:a03:3d0::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR10MB5613:EE_|DM4PR10MB6744:EE_ X-MS-Office365-Filtering-Correlation-Id: 5d73c895-864a-45b0-79e8-08dcdbe95bc6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|10070799003|1800799024|376014; X-Microsoft-Antispam-Message-Info: irAcSunEduZxK15oui3zM+XZAjh4tFJjZgRXp1y5skI8uIiIayvkbycAdsdGUxLoS1e9xIC4H01ioGSF7DIxxYv4D3MHzAVv1rJ+QvOYQwP2jHNJd/AkpkWtvB2m5yDnfGABboCgJLugWGv1+CCKZK/Cm/1wxEg8eYRm5I12ZxWdDA2+oB33SmrY1vEwWFYKQl+32hj5A8d0EoH3gjAVfil/Kc9YxNTdMbWr1F+PSmOo3ZYGjYnvnJn8mcClzFX15q9ZUf4efrFp9w5SkBI9tMZbh2i+cMP4kKvPEBl5qLSdN5BC6SYhCba4mQj4u5nJSLjQcMO3MLR857EXovff/9Mexa6KJVMr/kxIEjUDe9iKWlraGHVLru17ub6JZeg7yxy0SRkMYrCMP4VjvJvMlw8bTflU2ebugiITGlTzhbSVFqdE6JGk+9+JH+rxZawhy4IVGe6QCAkXWeUJjP5Mq6EteFJB3XTYGQTVs1/Va5AqrL/f7wMZSz4uOzHqhUNoz06558b2YMlOqK89J91OD7oZ2aHeat3nCvmDQc7L+arjagDlobvD9JK15tlw2XjOWChV/+u+YyLcep+RVu0iLFT1ig5Mr/6s7B5HJp44uJw0oEcX06RMPsJcD3sCVf3zunKQmDD95jWNmVjeEHnPHgirB/Wk2Mfs7OYWUZkdL8kwV1irdvGrUkJA70neKgXcSVukuxQa89coSK3vAaUh+W3v8+dMQ6geauqhsq+VN+uJpdG8WzMjXOzbFnU0SeA1L+6nW6B+CKBEHBBv246fjzpfkWt76f8cSrMTGxgmDuDiT79mfrdoznS0b8f206/NBzCRG3toCyYpiCjttXh4ORdIqjMvMfvDosgpghPRS/O81l52r4t9a5cdbTvAnVXw/vAF2Z/lc5eBV8hKvaFya/W6jJYI0yUa7oanCYG9wCrweLNcjU5gFiSjVzirzYRW8EeMUNtykWCqMEEBR0OEyZjvD1GSe+r9izYL+hjCiu+t7dzInnLyu9WlB5D1TavtKEcHWm89spJ6uSaLKfQKtOTLI0KRHPb2GoOSiZp3vx7SpAFR2rh7EDkK92M9bvWmTGmEQ+KfvCE4A+23vGSROSm8Tipf0lALIGW5jLnK7rQ07yuvLEWBdWUIAd9F63Mkz17Z3+bquPecdvg/6k/PT2bELDfQoc9p20tpvU+sWWMIQjoa+IVJu/V4//Ir4hadPZMxw1iASHYkQ2mHbI4V+q3fHxIYVpPznbAK9kqSu/V5f8CyMP95x8ueBU2cjLQlkxgKbD/YkmX5sFe8q59YzKAkugQllBSpXyYJpKGsJCv8NFlNOrSc7RLR1FRwrnhjVt5biL3XsmqInIm5+IAzTg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SJ0PR10MB5613.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(10070799003)(1800799024)(376014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: J51PnNrzHeBy6qqilOStJgR7xOctCD/BAgWglYn6AaROT2kOH0GbSDi77kx96fDdMwx/0VAgsbjWzMysia7WrjGF713Zdvq+v8osSEewcWvzECaqqV51RBj6is+6Oe8PwSgtg+JCzqvomnPy7wyyrxRp9P17MpB8mH03aVckIE7M/7e+c6O00FOcjLgx7jzVyJlKZG8nYud4Ob+W2IKWn5LgbeG6ky93h0qm9yEZfcY1JuusN80dSnr2BVuJyNaNGHQNFgNAHsQxaMArWAqP6WqKaZYw1rTRXZsRj95mez3KDgoWN6K6DCv2+9ySg3xghU7LgK5gv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XsNKgeovRzPU6mmk2SlX9C0EX75hf6BHSA8ByXZHmmohyyxOC0zAw+mnyK3rnzTUt4fPe1z2PpBWKL4Th73jZ0IxA5gKigkBr19pHCNtLt6+g3X1HW+7UEEMgPXOmRT9VSXSG54Y6870+Aee7rsb3TN2Fm53yXY8Uxqyt9dpimv8cJsytE6ci4xbUmcclfYiWca9wWqPtjxsK4T0DMITPqbIm/DsVvDWhso9hBvMRkWf7vF5vOdSoCBhXNylE9wpTEmhO8Ug9eSN8XfhPVSvhIg00+wWw== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 35F5tZRQUz+t6Q+4klRS85eQStmsuTSrIffgELSbzvvsVUjj/p+lHXvjTdJEHqpO3o58MvdB3NWVys2lzLntmcBXeLvr4dWeMSKHMDBTbUD8WnRxckRB6esHoMD9bKHdTTqXpCSS9ecdYik2gPxxBC9dqRY6OJqQo18uxcW5109mXWp6YFewnngkHipBGu7ZpHh4eDOWOAKwOxiaZ/IKcDP1Pp+90fjo/ljViZB2HyNtVyEWaaY1nehlC6uHjtHoL0fT0/AAbkZPIHtlbGn8zCFVj+0sAkGvkZHvM3ezJFzH2J+ip+eNKQwZliLEQMw1hcMiZKZzwxcU/S71/C1l7g6Lkx0jFGoedIK3hIALKfPXkN3gbU/4LO5+vEk11OKzmuD3bgdjVexayEKlgEZYHYyamx5SPCZXOcTqcAj80HKXi18uzFO3XZoKQXbLI5x9mpNLcXggp+U6BuaMcp5anD+8jb8bAuA5WP7gEd0sdo/8Vx7BL3aD+foC6yv7xUReEokVTKGFnh82gJaBIZvOn3YRg/usBJ7q3cOWxdYWGMxitZtf2ZolK88j9qt+fu/LTyX+ulvJNSrlZK57+tJ+W7UEDN05hy3ddMoIXNQZTdI= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5d73c895-864a-45b0-79e8-08dcdbe95bc6 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR10MB5613.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Sep 2024 16:04:09.4260 (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: 7oOrepPtiEsAShj2znTUld/aMb/SuKyTg6ulVbeq4uPv1h0fHco+ASi+Tur3H5beodgs/ENXZ7ntbW9ZBiKMYUzAvHyOph67tf1XDiT35aw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR10MB6744 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1051,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-23_12,2024-09-23_01,2024-09-02_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 mlxlogscore=999 malwarescore=0 mlxscore=0 bulkscore=0 phishscore=0 spamscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2408220000 definitions=main-2409230120 X-Proofpoint-ORIG-GUID: rrPXbEMX6V55EjXN4jVsHtEw7xKEkHpX X-Proofpoint-GUID: rrPXbEMX6V55EjXN4jVsHtEw7xKEkHpX X-Rspamd-Queue-Id: D6D652003C X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: 5zmcj9fr9665nc6xfjt6ja4iwu3kuuj7 X-HE-Tag: 1727107463-13993 X-HE-Meta: U2FsdGVkX18PAE4VKGklu9HYupoaWBdJrQKWTioLH9OpffM2N1Uq7QvhaX8o9/RVb0+ExuO5NyNM+6tdVB1+/NWWWEasMAAl7X7g+EvRkkilvNQ/eqP1z94Phdm/h9QcTs4Z71zvUPmRMsfMBFq1Z8N2HFSi33cg7mduY5r9TWeB5ySbheBZGv4+JdELeesc+Ry+ndr2I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FPXCuIGy2Yf67yOqwl+BxCcUxekeCrFqcdd4H7PRTXQDF2ikYARNodjx6K5AtBozhZNr1XnwyNpSBkGQLg/qOQA3fJQA7h4VY4r3OT/pua1LYTda9UMWfjC7KEHxWShJvr2ziUDsCwBbb2Yo1nghgS0QtJYhgBd0MF73+UsMXo2KTsAxhBnBAsEJtjtm/FRW12GkZPJuWBW38KXywhaY5yoNkuNpc3bft2o3em7qc0IshHHupuXfKtaDDrAHBfmnj+fCf2XsgAgj2p6EMcdzcgL5WczE2Q== 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: Add a new process_madvise() selftest, and add a test for the newly introduced PR_MADV_SELF flag. Assert that we can perform a vector operation of an operation that would not be permitted on a remote mm (MADV_DONTNEED in this instance) on ones in our own mm and that the operation is correctly peformed. Signed-off-by: Lorenzo Stoakes --- tools/testing/selftests/mm/.gitignore | 1 + tools/testing/selftests/mm/Makefile | 1 + tools/testing/selftests/mm/process_madvise.c | 115 +++++++++++++++++++ 3 files changed, 117 insertions(+) create mode 100644 tools/testing/selftests/mm/process_madvise.c diff --git a/tools/testing/selftests/mm/.gitignore b/tools/testing/selftests/mm/.gitignore index da030b43e43b..a875376601b7 100644 --- a/tools/testing/selftests/mm/.gitignore +++ b/tools/testing/selftests/mm/.gitignore @@ -51,3 +51,4 @@ hugetlb_madv_vs_map mseal_test seal_elf droppable +process_madvise diff --git a/tools/testing/selftests/mm/Makefile b/tools/testing/selftests/mm/Makefile index 02e1204971b0..7503ec177cd2 100644 --- a/tools/testing/selftests/mm/Makefile +++ b/tools/testing/selftests/mm/Makefile @@ -79,6 +79,7 @@ TEST_GEN_FILES += hugetlb_fault_after_madv TEST_GEN_FILES += hugetlb_madv_vs_map TEST_GEN_FILES += hugetlb_dio TEST_GEN_FILES += droppable +TEST_GEN_FILES += process_madvise ifneq ($(ARCH),arm64) TEST_GEN_FILES += soft-dirty diff --git a/tools/testing/selftests/mm/process_madvise.c b/tools/testing/selftests/mm/process_madvise.c new file mode 100644 index 000000000000..7a29b77d837d --- /dev/null +++ b/tools/testing/selftests/mm/process_madvise.c @@ -0,0 +1,115 @@ +// SPDX-License-Identifier: GPL-2.0-or-later + +#define _GNU_SOURCE +#include "../kselftest_harness.h" +#include +#include +#include +#include +#include + +/* May not be available in host system yet. */ +#ifndef PR_MADV_SELF +#define PR_MADV_SELF (1<<0) +#endif + +FIXTURE(process_madvise) +{ + unsigned long page_size; +}; + +FIXTURE_SETUP(process_madvise) +{ + self->page_size = (unsigned long)sysconf(_SC_PAGESIZE); +}; + +FIXTURE_TEARDOWN(process_madvise) +{ +} + +static void populate_range(char *ptr, size_t len) +{ + memset(ptr, 'x', len); +} + +static bool is_range_zeroed(char *ptr, size_t len) +{ + size_t i; + + for (i = 0; i < len; i++) { + if (ptr[i] != '\0') + return false; + } + + return true; +} + +TEST_F(process_madvise, pr_madv_self) +{ + const unsigned long page_size = self->page_size; + struct iovec vec[3]; + char *ptr_region, *ptr, *ptr2, *ptr3; + + /* Establish a region in which to place VMAs. */ + ptr_region = mmap(NULL, 100 * page_size, PROT_NONE, + MAP_PRIVATE | MAP_ANON, -1, 0); + ASSERT_NE(ptr_region, MAP_FAILED); + + /* Place a 5 page mapping offset by one page into the region. */ + ptr = mmap(&ptr_region[page_size], 5 * page_size, + PROT_READ | PROT_WRITE, + MAP_FIXED | MAP_ANON | MAP_PRIVATE, -1, 0); + ASSERT_NE(ptr, MAP_FAILED); + populate_range(ptr, 5 * page_size); + vec[0].iov_base = ptr; + vec[0].iov_len = 5 * page_size; + /* Free the PROT_NONE region before this region. */ + ASSERT_EQ(munmap(ptr_region, page_size), 0); + + /* Place a 10 page mapping in the middle of the region. */ + ptr2 = mmap(&ptr_region[50 * page_size], 10 * page_size, + PROT_READ | PROT_WRITE, + MAP_FIXED | MAP_ANON | MAP_PRIVATE, -1, 0); + ASSERT_NE(ptr2, MAP_FAILED); + populate_range(ptr2, 10 * page_size); + vec[1].iov_base = ptr2; + vec[1].iov_len = 10 * page_size; + /* Free the PROT_NONE region before this region. */ + ASSERT_EQ(munmap(&ptr_region[6 * page_size], 44 * page_size), 0); + + /* Place a 3 page mapping at the end of the region, offset by 1. */ + ptr3 = mmap(&ptr_region[96 * page_size], 3 * page_size, + PROT_READ | PROT_WRITE, + MAP_FIXED | MAP_ANON | MAP_PRIVATE, -1, 0); + ASSERT_NE(ptr3, MAP_FAILED); + populate_range(ptr3, 3 * page_size); + vec[2].iov_base = ptr3; + vec[2].iov_len = 3 * page_size; + /* Free the PROT_NONE region before this region. */ + ASSERT_EQ(munmap(&ptr_region[60 * page_size], 36 * page_size), 0); + /* Free the PROT_NONE region after this region. */ + ASSERT_EQ(munmap(&ptr_region[99 * page_size], page_size), 0); + + /* + * OK now we should have three distinct regions of memory. Zap + * them with MADV_DONTNEED. This should clear the populated ranges and + * we can then assert on them being zeroed. + * + * The function returns the number of bytes advised, so assert this is + * equal to the total size of the three regions. + */ + ASSERT_EQ(process_madvise(0, vec, 3, MADV_DONTNEED, PR_MADV_SELF), + (5 + 10 + 3) * page_size); + + /* Make sure these ranges are now zeroed. */ + ASSERT_TRUE(is_range_zeroed(ptr, 5 * page_size)); + ASSERT_TRUE(is_range_zeroed(ptr2, 10 * page_size)); + ASSERT_TRUE(is_range_zeroed(ptr2, 3 * page_size)); + + /* Cleanup. */ + ASSERT_EQ(munmap(ptr, 5 * page_size), 0); + ASSERT_EQ(munmap(ptr2, 10 * page_size), 0); + ASSERT_EQ(munmap(ptr3, 3 * page_size), 0); +} + +TEST_HARNESS_MAIN