From patchwork Wed Jul 3 11:57:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Stoakes X-Patchwork-Id: 13722127 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 45A6617332B; Wed, 3 Jul 2024 11:58:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.165.32 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720007898; cv=fail; b=ReBW9yeRHWSrXZj4JzKEOQKiCoQZFqYs4TiWdEtRl+1qObv6Y9WC3zGA1kJvHZOX63yPZiIOqwT1Uw+b3xmYtXfQNAdY50BTXTXymm0PnuORM+VIZiS1+8K5JksU/laq4/eGeOblzQ/a3hEZ1iTaVq2mc90FKl1qlKcXZg0tiI4= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720007898; c=relaxed/simple; bh=XcfzE41GYLv7CnyyfANW1Q+qNQzAM2XvU8b8MGAggMI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=oEXAlUB3gAZWuF16WWaMmZF/TyyNkt7eTnquQUB6tl1tIgzN9f5zrS00CANTbo1h8tBGbaA07QIp1khiyLbIQQuFzEVxqnDFjP8J0ToS87tg5YDTPef6iNzfIXjq/+yaKFyDn6370NkM/4lS/ePbmsGYldlIkTpFf7Qec7mlmAw= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=dN9Iehes; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=BWTYIwvf; arc=fail smtp.client-ip=205.220.165.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="dN9Iehes"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="BWTYIwvf" Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4638OEA3015994; Wed, 3 Jul 2024 11:58:03 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=7yUoHz+y4bBA4WnYst+c6VR5ABPk6RgWVBzoDEOoRHM=; b= dN9Iehesf3sF/JZx9cSYvNCSJ3S6RKUkjzR4SHe/Q5oTtuz26EcFovg/tDET0ONo 45VoX1i5TsNFkh+sBqcKKo1NjQspUn2+Zhqw/ioExth+5kmVln++ViELVDtSLIqT kNARuqYMEWHKHKiVVkv4mPiSSeF9x4FWzlRnP5hQuTKiJxbyWh4mEHtj0iV87DmQ /yFjRes+zhn9dHQeo3j9Kh8BhTfHihmKV3oSeGELdMnagAYhh2huBGeuXd8nG9v/ J76jYzvD6sSZjprG8Hpa5CkRUCzm8MI0xi5Jfinkk3WOGCAbGV1tem1nwoSSc4Jz ny5cV+yld9tVMz613S8Wlw== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 402a597t25-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 03 Jul 2024 11:58:03 +0000 (GMT) Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 463BN5Cb011150; Wed, 3 Jul 2024 11:58:03 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2168.outbound.protection.outlook.com [104.47.59.168]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 4028q94qwb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 03 Jul 2024 11:58:02 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aDkT+6ELJfItLUro7PYC0ITfXxMpGuToxNo5QXMzIfwn8tAuiiLITTDW+jNOe/FNgB7Fg+pRkUU0dS3v/nJi6EbcS8EGzTK/c2qKi6UxL5imnekcoK5K6sl5yGojZalspUSYfzdG5g3burwranEOtNHxdganjxvNfr5Fwy0pKsIMDEL5/mRr6GhbXLYjPlDeA2FMcRebVjSarh4afNXPsc0nbTrdfkXyBloYVKuvxNB6AcAB1/hcAwpMHRJkEn7OUmq4LcqbhJkgt4zzo9A2a78JoB7yBVuC6kCaPwZ3IYY7T9B8LNaFT84s6UwUXG5vwAtbUULKAsaAzxdRUnmO8w== 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=7yUoHz+y4bBA4WnYst+c6VR5ABPk6RgWVBzoDEOoRHM=; b=El79l+rZxvsF5XCzve44uDZnD+RkXbM0nhoH7ebDLFYhk3wG7ceLxHEmFuZWklYJMm4xrutvU1MV+RkH/eY5Mps9hNPUu6KMgHLUMF73rE4vl6zaXKoSJu9SHtx/et6Q1fG1vfPphSVU0pNLCF0sei8Y33mfhu/sU12YIBn/EJZfw37SOcnUDW3i0HeRzKKRJXZTi9DKySHNEf1fNnYio2pW6yaxCoW3LKosrsskdfZSXtrG4XTIoBsIvJjERHA/Ek3lgfpIKhFMbewawThrwj8e2jznb5nnuEtTwPpaYi0UG2oR7YS+7pjJEFBMxsM6F3ekcPEYZhyYm7YvRBFnCw== 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=7yUoHz+y4bBA4WnYst+c6VR5ABPk6RgWVBzoDEOoRHM=; b=BWTYIwvf6w4SA7G7s7PIryiulNMV4k4eTkUbvF/WiM1r5fo+/MONxbP3E61Ykt7JAsaHe8p4Hq6axISzrC6lKQB134n9mikaiEoy8Yn1WN8Fq3LyZRCXFv/WU9KbddMnyMCYO8mJ5PKm9ClKPDQHZFweOxGkIma2dPZIv+7/Luk= Received: from SJ0PR10MB5613.namprd10.prod.outlook.com (2603:10b6:a03:3d0::5) by SA1PR10MB7832.namprd10.prod.outlook.com (2603:10b6:806:3a9::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7719.32; Wed, 3 Jul 2024 11:57:57 +0000 Received: from SJ0PR10MB5613.namprd10.prod.outlook.com ([fe80::4239:cf6f:9caa:940e]) by SJ0PR10MB5613.namprd10.prod.outlook.com ([fe80::4239:cf6f:9caa:940e%6]) with mapi id 15.20.7741.025; Wed, 3 Jul 2024 11:57:57 +0000 From: Lorenzo Stoakes To: Andrew Morton Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, "Liam R . Howlett" , Vlastimil Babka , Matthew Wilcox , Alexander Viro , Christian Brauner , Jan Kara , Eric Biederman , Kees Cook , Suren Baghdasaryan Subject: [PATCH 2/7] mm: move vma_modify() and helpers to internal header Date: Wed, 3 Jul 2024 12:57:33 +0100 Message-ID: <2f6f2495f8c821d30a29939a2a2c0869ed6205db.1720006125.git.lorenzo.stoakes@oracle.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: References: X-ClientProxiedBy: LO4P123CA0616.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:314::16) To SJ0PR10MB5613.namprd10.prod.outlook.com (2603:10b6:a03:3d0::5) Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR10MB5613:EE_|SA1PR10MB7832:EE_ X-MS-Office365-Filtering-Correlation-Id: a8a3de96-a0f2-4e4f-12ef-08dc9b57610d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|7416014|366016; X-Microsoft-Antispam-Message-Info: vJ9KXN67Uot/M3pvScGJblU6CQlSHjNoP3UOC+SdNShvMtugvbWyDqD/mesRXEkH1zG92F77l7PqXIQUPgJEcAWxR5KxTJdie5HOBJwKNLe31WFEMwPX/CESh4I0Ke/GL8cTbTioXZjVCnr2d0ZKrdjbWZIX1hN1ryKIvSFonLp6oD/Rgi7wffst/di43iCtTnk8T+9l02xeT7GVfUe+zm6KPEuTawni3u9/XopHOXa6YaM3Ebj9VM9qXj3IRWtUdvbX1Ce0PaW3ZA6idm2Td7Npv3SZJWO1wz/si1AepgIrsb+EdnMYBWPJsb8c8oNkTU91yOTUobFY2nkCQZ4FwynE9BAizXOcLpjAVBR5BjpSBxQxLrQW581P4uxhfuxcznYGkuQ82+fa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.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(376014)(7416014)(366016);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: RHkaAHpyNH2XKEwo/6KBR5SPyUB3TmbyNcnVfC1Ytonnrq+RM+Uoxf/eswdA7zyhHDeu5CST9CyJ2+xLT2Y+b5YpUcoC41D8dPvjlq5CoSZIdNKXlByi0vJ8+qm73oy/cc91sq58w1aL8Ox6oDyP+6wl1o834d4tDhJWcEFWcbqjKdocF1qsciTUtEYwFuujc1l/gQfxmuVR3tcky5MEV0JNP5OR1mhbxtw7HtHGBnMjr+0fN49oSUHqrRJGWCDA/MO2i6cUYKU7ZhtTNJvm+yoXULIPI40DAnDYsvyi9DHEMMM2av0Flsdh0e4ksOTqMNSoELA8jmnz3TkF6uoweHWCVnoPS5oxYWT6A8G6j50vojihJwBe08zuq1aXTdYM3SBUs+g9PwaQ9GgGYP2WUgsAVVJ54MmWWNaYcfNbvFQlmY/kN4I+ZtDjbl6GuWXa4mu+EIfWGZ2lLL8nuhPM9s5IHIEam37nQsOERbOHBtYk30POyfnxOm4trQWRTb6UhzkLAMmoGHQVi0ezQOTkcXbdB6fQK5kA4QwxsWgdYf8P1uH6G8nlQys13spm7UvmZDGX+RCw0KS7j9Z1r8R8ckJvYpATO/kiy2yXhaID9Uh66B4djSMvJM5u1HjO7nDShQH/bfNZ30Hadv03GmNyg45qpk0NEIg1zPha1JxeibJUsbdAnaqS71f7nl0/oae+MQQ/+ZkTIs6+KWNXT9ckV9mOK/ym04bOxRF358Ac9+T/C3Km8IPgAD0z2KgqMVj1e3pRB3M8/ZFW/Opeq4FNqp3ovKRUMXuAVinOHrKjR418MTD0gZejh9656DeMDxr+99j8o3qz1CWR+7bTqoVjAmt5sM/SsyDGS81s2gt2zVXx/8kh3mbofeKbZ800Xm03B5cl8wmosahGJeAIOXT60tmnuQzKYbOYKs/7LsZEBYEjBeZAcqPnf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zLiYBhGwMhE4+KmGBybPYHPSZ/Z/jExoVLAAUg0z9HVt5XtM6iqLLw1pQYnK6mIdbqotLmUxQLSDdkvUGauGCVYtiYcauljWD4Y5dF2thO4ZWfDAuHjTvx6qB9TZmP4j5L7IZQBHo+aOYG/wuFHNNiQO5avEK12JvrrCyB6kjYOXIcRa1ETZyzX/gwJsdC+jmFbNF7K23NvLBXpTa/bKdDaAsKK39Ke0TZroybIIstTSOqBQqsupq/1r10Px3s5jiOOe/1RQoPma59k8b5l1zIBUwzOGlfGxM= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: a8a3de96-a0f2-4e4f-12ef-08dc9b57610d X-MS-Exchange-CrossTenant-AuthSource: SJ0PR10MB5613.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jul 2024 11:57:57.4588 (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: 2vJZa3xwMrTn6w3nADsg6FUESyC6Z0/4KebzIkfR1sHbGG6g3EKa0HbeZ65Vj2UuYP/ciskILOjvdHN0wz5aQbqeZzePncjXBUhSAXizZpo= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR10MB7832 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-07-03_07,2024-07-03_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 phishscore=0 spamscore=0 mlxscore=0 adultscore=0 bulkscore=0 malwarescore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2406180000 definitions=main-2407030087 X-Proofpoint-GUID: vl632y-O6NRTEeUT8MezFWmNChGiz6qE X-Proofpoint-ORIG-GUID: vl632y-O6NRTEeUT8MezFWmNChGiz6qE These are core VMA manipulation functions which invoke VMA splitting and merging and should not be directly accessed from outside of mm/. Signed-off-by: Lorenzo Stoakes --- include/linux/mm.h | 60 --------------------------------------------- mm/internal.h | 61 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+), 60 deletions(-) -- 2.45.2 diff --git a/include/linux/mm.h b/include/linux/mm.h index 5f1075d19600..4d2b5538925b 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -3285,66 +3285,6 @@ extern struct vm_area_struct *copy_vma(struct vm_area_struct **, unsigned long addr, unsigned long len, pgoff_t pgoff, bool *need_rmap_locks); extern void exit_mmap(struct mm_struct *); -struct vm_area_struct *vma_modify(struct vma_iterator *vmi, - struct vm_area_struct *prev, - struct vm_area_struct *vma, - unsigned long start, unsigned long end, - unsigned long vm_flags, - struct mempolicy *policy, - struct vm_userfaultfd_ctx uffd_ctx, - struct anon_vma_name *anon_name); - -/* We are about to modify the VMA's flags. */ -static inline struct vm_area_struct -*vma_modify_flags(struct vma_iterator *vmi, - struct vm_area_struct *prev, - struct vm_area_struct *vma, - unsigned long start, unsigned long end, - unsigned long new_flags) -{ - return vma_modify(vmi, prev, vma, start, end, new_flags, - vma_policy(vma), vma->vm_userfaultfd_ctx, - anon_vma_name(vma)); -} - -/* We are about to modify the VMA's flags and/or anon_name. */ -static inline struct vm_area_struct -*vma_modify_flags_name(struct vma_iterator *vmi, - struct vm_area_struct *prev, - struct vm_area_struct *vma, - unsigned long start, - unsigned long end, - unsigned long new_flags, - struct anon_vma_name *new_name) -{ - return vma_modify(vmi, prev, vma, start, end, new_flags, - vma_policy(vma), vma->vm_userfaultfd_ctx, new_name); -} - -/* We are about to modify the VMA's memory policy. */ -static inline struct vm_area_struct -*vma_modify_policy(struct vma_iterator *vmi, - struct vm_area_struct *prev, - struct vm_area_struct *vma, - unsigned long start, unsigned long end, - struct mempolicy *new_pol) -{ - return vma_modify(vmi, prev, vma, start, end, vma->vm_flags, - new_pol, vma->vm_userfaultfd_ctx, anon_vma_name(vma)); -} - -/* We are about to modify the VMA's flags and/or uffd context. */ -static inline struct vm_area_struct -*vma_modify_flags_uffd(struct vma_iterator *vmi, - struct vm_area_struct *prev, - struct vm_area_struct *vma, - unsigned long start, unsigned long end, - unsigned long new_flags, - struct vm_userfaultfd_ctx new_ctx) -{ - return vma_modify(vmi, prev, vma, start, end, new_flags, - vma_policy(vma), new_ctx, anon_vma_name(vma)); -} static inline int check_data_rlimit(unsigned long rlim, unsigned long new, diff --git a/mm/internal.h b/mm/internal.h index b4d86436565b..81564ce0f9e2 100644 --- a/mm/internal.h +++ b/mm/internal.h @@ -1244,6 +1244,67 @@ struct vm_area_struct *vma_merge_extend(struct vma_iterator *vmi, struct vm_area_struct *vma, unsigned long delta); +struct vm_area_struct *vma_modify(struct vma_iterator *vmi, + struct vm_area_struct *prev, + struct vm_area_struct *vma, + unsigned long start, unsigned long end, + unsigned long vm_flags, + struct mempolicy *policy, + struct vm_userfaultfd_ctx uffd_ctx, + struct anon_vma_name *anon_name); + +/* We are about to modify the VMA's flags. */ +static inline struct vm_area_struct +*vma_modify_flags(struct vma_iterator *vmi, + struct vm_area_struct *prev, + struct vm_area_struct *vma, + unsigned long start, unsigned long end, + unsigned long new_flags) +{ + return vma_modify(vmi, prev, vma, start, end, new_flags, + vma_policy(vma), vma->vm_userfaultfd_ctx, + anon_vma_name(vma)); +} + +/* We are about to modify the VMA's flags and/or anon_name. */ +static inline struct vm_area_struct +*vma_modify_flags_name(struct vma_iterator *vmi, + struct vm_area_struct *prev, + struct vm_area_struct *vma, + unsigned long start, + unsigned long end, + unsigned long new_flags, + struct anon_vma_name *new_name) +{ + return vma_modify(vmi, prev, vma, start, end, new_flags, + vma_policy(vma), vma->vm_userfaultfd_ctx, new_name); +} + +/* We are about to modify the VMA's memory policy. */ +static inline struct vm_area_struct +*vma_modify_policy(struct vma_iterator *vmi, + struct vm_area_struct *prev, + struct vm_area_struct *vma, + unsigned long start, unsigned long end, + struct mempolicy *new_pol) +{ + return vma_modify(vmi, prev, vma, start, end, vma->vm_flags, + new_pol, vma->vm_userfaultfd_ctx, anon_vma_name(vma)); +} + +/* We are about to modify the VMA's flags and/or uffd context. */ +static inline struct vm_area_struct +*vma_modify_flags_uffd(struct vma_iterator *vmi, + struct vm_area_struct *prev, + struct vm_area_struct *vma, + unsigned long start, unsigned long end, + unsigned long new_flags, + struct vm_userfaultfd_ctx new_ctx) +{ + return vma_modify(vmi, prev, vma, start, end, new_flags, + vma_policy(vma), new_ctx, anon_vma_name(vma)); +} + enum { /* mark page accessed */ FOLL_TOUCH = 1 << 16,