Message ID | 20220202024137.2516438-42-Liam.Howlett@oracle.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 A6282C433EF for <linux-mm@archiver.kernel.org>; Wed, 2 Feb 2022 02:43:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7743C8D00BB; Tue, 1 Feb 2022 21:42:56 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 6F66A8D00BC; Tue, 1 Feb 2022 21:42:56 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 521018D00BB; Tue, 1 Feb 2022 21:42:56 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0188.hostedemail.com [216.40.44.188]) by kanga.kvack.org (Postfix) with ESMTP id 447388D00AF for <linux-mm@kvack.org>; Tue, 1 Feb 2022 21:42:56 -0500 (EST) Received: from smtpin28.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 131E0829F677 for <linux-mm@kvack.org>; Wed, 2 Feb 2022 02:42:56 +0000 (UTC) X-FDA: 79096292352.28.6C72DA8 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by imf25.hostedemail.com (Postfix) with ESMTP id 1BA44A0003 for <linux-mm@kvack.org>; Wed, 2 Feb 2022 02:42:54 +0000 (UTC) Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 2120ULVM005139; Wed, 2 Feb 2022 02:42:54 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : references : in-reply-to : content-type : content-transfer-encoding : mime-version; s=corp-2021-07-09; bh=aPiHEaoermedxMt7GzHndFvmaSchc1t2TgteamH9Da4=; b=ynxQLJi9hQTx0TDUd/s5wdKpd2oCYg8fUX1CviuNt10c3A5qIarFM0tochEbdOSDJbms y6ewF+id9O+fa4ic0dqw+bKO42DzuNs1zWDmlALaJ+PQwDquXoW6yrajoddbQUad9Sf8 BBWv+jmvJti9qtWt/tLBONkwHDLE2Lnc3YnBTI/SlIcjAOnLDARIjc/Y/Kto9/Rzj4mX 1LEz7vJAfrTZzYBT2q55z+hBW98vfc7SwMQTaBcS7bVwFyDvpk1B9QRUf7hmON7ffMZq djuZqiEna+50hJ/jlvjsHUAYBZjjhddyH0KN8Vz+8xclfBL8OxcszSDv3CijmJLF3Bh3 zg== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by mx0b-00069f02.pphosted.com with ESMTP id 3dxjac4qet-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 02 Feb 2022 02:42:53 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.1.2/8.16.1.2) with SMTP id 2122Zsu5007633; Wed, 2 Feb 2022 02:42:52 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2048.outbound.protection.outlook.com [104.47.66.48]) by userp3020.oracle.com with ESMTP id 3dvy1r8aet-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 02 Feb 2022 02:42:52 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gRWmpL5oeWDZ9fkHPbUgj+Zklvl1/vT7wo8zBoowXTUPFrMSd0z/YIUQ264pzfs03+sQrdFlEqWE9K2pX//FMlnpbjpJlz9hHKUvZUUVquhqUV+O76S6pd6zZX0g2/uM0NLSHCukqMtmkSVXBK/o8VPnV0FmhNW+l1Ud2c+g/Uo3cjKgNXHNgJrOx7O0LAWMCVW//vU8ChgFpxa4EqspM3/dzGd8Xz9ZBKtE2WpTEFv026mEu4duyH4dg09XUveyKSRFDv6V8gfwpX5CsM9e6fAZrFdOFyZNtNEOPFuMjCXEkaj7x6tZo+B9KIJi4fcYoW3qqVcxWdW2cHHTfomTog== 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=aPiHEaoermedxMt7GzHndFvmaSchc1t2TgteamH9Da4=; b=dk1NsiV4P14dTSvIdhuZ843ttzUl58AkYojGf4l2rxJbM0xS3FlOmAZ6wy/2E7HoDgKjV+yXArnky0lQP/t5559gVgDIT+AqOOz0k9cejk9jXVM3bmaTeVtgIuNOYa3WRfh2VOJCMDPKxihaAXiOwURCzGw9bAZVrVGfAMnmJtr8xDv4fsJCmdFkDojWMIXiVF6G2jpgMt31pu9exZ9riQCoAmFAeooMlw5+4lVx3NeNqmz1hfnbPt0dBdg6ikE4SoywEGmw0DvIA2h350PS4oUZIcY0AaEEILhUn5pAQon1bh+3DN9aJnFeA/TsYqn6sVEu/7mipVg1hQcMCkdaLg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; 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=aPiHEaoermedxMt7GzHndFvmaSchc1t2TgteamH9Da4=; b=YfzM0Kv+er2tCRlS0lbtgzGbqHk0y+f0JcRRxJEh7ifdo9ApDjkk7hzOsbEp5t1lQRidnFNlI6usCZfrYS2gMAmzrH5HnUGGfv96gfysHvIRfBuN8q2Wo0oKCzBCnav4O+ybyJ5ES5tDNUwltNnWSo4SgfuehjJ3qzumrLu1T5s= Received: from SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) by CO1PR10MB4801.namprd10.prod.outlook.com (2603:10b6:303:96::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4930.15; Wed, 2 Feb 2022 02:42:50 +0000 Received: from SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::3857:3a25:3444:fdd3]) by SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::3857:3a25:3444:fdd3%5]) with mapi id 15.20.4930.022; Wed, 2 Feb 2022 02:42:49 +0000 From: Liam Howlett <liam.howlett@oracle.com> To: "maple-tree@lists.infradead.org" <maple-tree@lists.infradead.org>, "linux-mm@kvack.org" <linux-mm@kvack.org>, "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>, Andrew Morton <akpm@linux-foundation.org> Subject: [PATCH v5 41/70] coredump: Remove vma linked list walk Thread-Topic: [PATCH v5 41/70] coredump: Remove vma linked list walk Thread-Index: AQHYF958muUiIgQWq0CdDHipHiHyag== Date: Wed, 2 Feb 2022 02:42:15 +0000 Message-ID: <20220202024137.2516438-42-Liam.Howlett@oracle.com> References: <20220202024137.2516438-1-Liam.Howlett@oracle.com> In-Reply-To: <20220202024137.2516438-1-Liam.Howlett@oracle.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.34.1 x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 1d9319f3-d176-4e55-04aa-08d9e5f5b3c8 x-ms-traffictypediagnostic: CO1PR10MB4801:EE_ x-microsoft-antispam-prvs: <CO1PR10MB48012E81A23BE853AFE80505FD279@CO1PR10MB4801.namprd10.prod.outlook.com> x-ms-oob-tlc-oobclassifiers: OLM:6108; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 7sBe/elGMLg3Lh0LTNuFGTBlnVp+4TTw0ZiSfcdX3XVRp6boywI2xq99s0Qp82Ecty/75FfdPTFTJ9xstazrulyjVVqmVGEsvWffaakw0UPYz/lk5EFy6Hxx1s/klCVdIcvx4sC9D5W2hT3MP0IyYlIH/U6czyDT63Pjw4D7nfS54EIdip2wKZT43NQmC3H8BFngHWlBqgv+qIN5kd23NmYicHVa1DsP+fe6PjHAxkXx4DEl8JIdHu9WYCA+nBHr9Xdcu9kqSxxQGkfm5hN3cf297zGuFUifg0628tTwZAtIv2HPEGmIrEx3YIITKsyHEEpGCUlYF1rPTdFCKgvcmr8yEccw96zgsGeV3R7hfYXhDHS3QVQzMXdfFwMZsH+f0sSM6DsH+8oIc2dZJAMN7C9oztIOTJHBhOwPl68plNN0+DLNcapi5a+FzNfZqRoXW41dW3981nRzs9Q7fhw08KvqYyS33C0hIXCLYo5FgfeYbEc0vkc1kkCOYaS8icXfb2geuSbOTkATA82SsKxUemSBURPUdGmh6YUZkZSB+guS0zr2qNCtwwhyyIdu0asfQj6OLuBXzysENUbl3t4UqY0JfYd2RWb6Nv6wPNcvE/5/fIt4sDBDvUjsHsKW8WTq98T5KQcitCmykxHxEPY+9sY3GzpgVbA76AfZqdEnA6J7xhYcEz89bWm4mnwVHGpZMR/bAJV2ZtImFtai4LO+mg== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN6PR10MB3022.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(366004)(186003)(508600001)(1076003)(26005)(6486002)(122000001)(5660300002)(36756003)(44832011)(2616005)(6512007)(6666004)(6506007)(83380400001)(2906002)(38100700002)(66446008)(76116006)(86362001)(38070700005)(91956017)(71200400001)(110136005)(66476007)(316002)(64756008)(66556008)(66946007)(8936002)(8676002);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?Vzz1wH4j7IAWwnuNuRyrjjX?= =?iso-8859-1?q?NHivK5iIjN2JUJBBFFDWZZnVT49t9siP9uI7lZnnYRrkAbG27XP+IoZxWh9e?= =?iso-8859-1?q?apPpRLNH8Xzmrt9xsHfsyJZR1RhAKTQEzXopYcmt5QbcTLUw52Y+gYUdUM85?= =?iso-8859-1?q?xUuH4pDYkr3R7U6WWm4Oof6SWIG0nzXwQHJm+yQDTTuckVoBOJdNCpo7imT9?= =?iso-8859-1?q?DDXOiwmC6wuxqDUc4F8U/aGoy6xjh88jFLpo0awE1CJz5Meq3YQ7aSsOuQ58?= =?iso-8859-1?q?mushdHAOKV8t0K978PWTu4tjG0hZxYq56tGhYo47FjgpNh4ZjvbgJJS0AivW?= =?iso-8859-1?q?+iJ6itKfJ3WwBRrpufrgVsk5nN12jZtbOw/iHIRyyQKRdrbGXJlZGb9lBtEN?= =?iso-8859-1?q?aHfx8ZxxFYxBz+fwiNy4tKYlssnKb9MIsMQg6uX77NSv9fhDpXcWofoUXn2A?= =?iso-8859-1?q?VsYeTdbeMkDag4o0zcBVBoRMh5PPh8xJVg1l327WNwd2jMZQQOr7lmalcK1a?= =?iso-8859-1?q?b1beR/Wb8rCD+jqIksN6unvQAL+jGXJP8SF7Z3Ygf8fJi2gfaOHe0LU2iJcY?= =?iso-8859-1?q?3HqkVbwA8ReBMaBn4aB+/puOUBulL+1oqHST/XFpgCpYWuJ0g6gOkOkoNU2d?= =?iso-8859-1?q?ggPyuPMU7NoqX70Jx+l6Zsp1XmwMDPweGUwO+OCbC3VivMKrbvRTOXTBjzju?= =?iso-8859-1?q?ej+qJBkilbbwlR+gQOdKHBMkiXAnLx/wW/jUhdr8NtUAzAOFirS9ti79TVvn?= =?iso-8859-1?q?BocDV3iPI+BN2jG2/zSJIx1eB6cxYMVjHC5SPmzqlfTijekXuijSJ/8Jsye6?= =?iso-8859-1?q?WnPCvr5/+I+Wy7n/ZUAw0ejrU7oxnj+wzV+8f2NNS37mBt79kneVfm4RWUz1?= =?iso-8859-1?q?ded65ekoXJMdJ9UqrYkw6byGBNkvGHDBYgbsG+PpmP5vHzKH0a4RrKmcDWlO?= =?iso-8859-1?q?07SuIToRGQg/MJg3I+AvUngJB2y1cfqF6v/djqYbpfDASEc6bqo9M6lpsRl1?= =?iso-8859-1?q?d106AQ4c2HT7QZOLClkimQ8OdV8BRlYoVPr5r3Mygi+an7UbEmTNot0f2PSR?= =?iso-8859-1?q?wx/UQFNMfAbQUOYUEHbJOuuPD/cqe4LMpntZdtuVvXqO2M46KdFFf7Cz7cir?= =?iso-8859-1?q?GZq+5dP81ng3kBO7IluhPtWtlj1khDCIRirun+GnWFc9bp2WYNYuGTUF/2Ob?= =?iso-8859-1?q?j6YMsjK3SqJtXy5UnJedWR6e6we4ghDHxXHo4gxM8MfU8jTiGRJ8mMqANYm5?= =?iso-8859-1?q?8IguJdx35A1NvJYLtlWpgFvec2N3EuhGU10xUYi4QtfuEPB7lk9Qdu/Bab47?= =?iso-8859-1?q?003HOy5KI2iHDNvCN7FEoe0TseJgFyMCOw/ECkDlqDcIQhSv31qlqYJIq8I6?= =?iso-8859-1?q?dUOBj6N3D4IU5IYhWxl2DwT6RgNKhFtTfwFpW4g3hRUXZ+QEUfitpt8/0xxH?= =?iso-8859-1?q?1eJw9QkpnHMPaSj3fFYdPHE/wxKmUXnUMtVTyNOCFGUelxPu+gd+KLBIL1Cy?= =?iso-8859-1?q?GVRriDKo43uNJXps/3tOGMf8X+HtctROie+H+X5lR7TKis950zi9XeMgv11T?= =?iso-8859-1?q?W6mHu1rVe059SB/bSlMSLIWvcFSVryo1iTL9gOPxIWnYKwso2yX9C3QDvTP1?= =?iso-8859-1?q?HZQNoXEHR7Nkm26CTZAUIoszecrue0zHKZSLvdYZaWQ1dfR+ruiJZw+uZ5xg?= =?iso-8859-1?q?=3D?= Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: SN6PR10MB3022.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1d9319f3-d176-4e55-04aa-08d9e5f5b3c8 X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Feb 2022 02:42:15.4699 (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: NzsxPUb2O/BvKt2N5ruijq/dbb6w6q0qvyWhHKgkHvRoNgJVOrXa5o/6OQhU1fcMsw7Z917FZBazb3hqqyjByA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR10MB4801 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10245 signatures=673430 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 mlxscore=0 spamscore=0 bulkscore=0 adultscore=0 mlxlogscore=999 phishscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2201110000 definitions=main-2202020010 X-Proofpoint-GUID: BwvfRrEAR69k6zMkNeqQA-IFyzKkVgre X-Proofpoint-ORIG-GUID: BwvfRrEAR69k6zMkNeqQA-IFyzKkVgre X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 1BA44A0003 X-Stat-Signature: 7q9q8o7dygaihknjpa86ehoq7ryt3e9d X-Rspam-User: nil Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2021-07-09 header.b=ynxQLJi9; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=YfzM0Kv+; spf=none (imf25.hostedemail.com: domain of liam.howlett@oracle.com has no SPF policy when checking 205.220.165.32) smtp.mailfrom=liam.howlett@oracle.com; dmarc=pass (policy=none) header.from=oracle.com X-HE-Tag: 1643769774-574277 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> |
Series |
Introducing the Maple Tree
|
expand
|
diff --git a/fs/coredump.c b/fs/coredump.c index 1c060c0a2d72..127dffd0517e 100644 --- a/fs/coredump.c +++ b/fs/coredump.c @@ -1051,30 +1051,20 @@ static unsigned long vma_dump_size(struct vm_area_struct *vma, return vma->vm_end - vma->vm_start; } -static struct vm_area_struct *first_vma(struct task_struct *tsk, - struct vm_area_struct *gate_vma) -{ - struct vm_area_struct *ret = tsk->mm->mmap; - - if (ret) - return ret; - return gate_vma; -} - /* * Helper function for iterating across a vma list. It ensures that the caller * will visit `gate_vma' prior to terminating the search. */ -static struct vm_area_struct *next_vma(struct vm_area_struct *this_vma, +static struct vm_area_struct *coredump_next_vma(struct ma_state *mas, + struct vm_area_struct *vma, struct vm_area_struct *gate_vma) { - struct vm_area_struct *ret; - - ret = this_vma->vm_next; - if (ret) - return ret; - if (this_vma == gate_vma) + if (vma == gate_vma) return NULL; + + vma = mas_next(mas, ULONG_MAX); + if (vma) + return vma; return gate_vma; } @@ -1086,9 +1076,10 @@ int dump_vma_snapshot(struct coredump_params *cprm, int *vma_count, struct core_vma_metadata **vma_meta, size_t *vma_data_size_ptr) { - struct vm_area_struct *vma, *gate_vma; + struct vm_area_struct *gate_vma, *vma = NULL; struct mm_struct *mm = current->mm; - int i; + MA_STATE(mas, &mm->mm_mt, 0, 0); + int i = 0; size_t vma_data_size = 0; /* @@ -1108,8 +1099,7 @@ int dump_vma_snapshot(struct coredump_params *cprm, int *vma_count, return -ENOMEM; } - for (i = 0, vma = first_vma(current, gate_vma); vma != NULL; - vma = next_vma(vma, gate_vma), i++) { + while ((vma = coredump_next_vma(&mas, vma, gate_vma)) != NULL) { struct core_vma_metadata *m = (*vma_meta) + i; m->start = vma->vm_start; @@ -1118,6 +1108,7 @@ int dump_vma_snapshot(struct coredump_params *cprm, int *vma_count, m->dump_size = vma_dump_size(vma, cprm->mm_flags); vma_data_size += m->dump_size; + i++; } mmap_write_unlock(mm);