From patchwork Wed Feb 2 02:42:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Liam R. Howlett" X-Patchwork-Id: 12732637 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 A5013C433F5 for ; Wed, 2 Feb 2022 05:07:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8E4368D00EB; Wed, 2 Feb 2022 00:07:26 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 8943F8D00C9; Wed, 2 Feb 2022 00:07:26 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 70DAE8D00EB; Wed, 2 Feb 2022 00:07:26 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0220.hostedemail.com [216.40.44.220]) by kanga.kvack.org (Postfix) with ESMTP id 61BDC8D00C9 for ; Wed, 2 Feb 2022 00:07:26 -0500 (EST) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 22055181CB2D2 for ; Wed, 2 Feb 2022 05:07:26 +0000 (UTC) X-FDA: 79096656492.18.1DE34B7 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by imf17.hostedemail.com (Postfix) with ESMTP id 8E90040002 for ; Wed, 2 Feb 2022 05:07:25 +0000 (UTC) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 2120Gv7a026579; Wed, 2 Feb 2022 02:42:55 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=9oXDIBGXs5l2VJ0a0gQKjxuZtcMnhHZqI4dSc7CPvDQ=; b=NVzo+hwJY00fyjsNC7b6tIoNFp5O719K36HW9Y43WhTzMZKlMva1KsC36nFjPt3dot87 xZZDPppfT2xydtVDgQYMYyefMWnSx/o6tB1oVb0hgrr89DYdGgPb+FWUy/G3aegPSWqR 1LUeHwBLDJMxTfdzQvsElhvcY4RZhLAQsvAuYU5FfNbRHCDUj02zMyrP5Et1tGHMSaZN NrdplBMmuJWWuXDikYVW1PYJ7IDb5l3D16hTZP9eukmc3Nno4Ae7yf414WfWQX3gvlTg Koyz67IO9Q6vo7p73GDMfFKHUlJVaGhRU01kE1IfbghHK+BZk9ybUmaDuoKSCAua/R9q 3Q== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by mx0b-00069f02.pphosted.com with ESMTP id 3dxj9vcu1u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 02 Feb 2022 02:42:55 +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 2122Zsu8007633; Wed, 2 Feb 2022 02:42:54 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-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 02 Feb 2022 02:42:53 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NLBK/wzH2/8N5+UfNYHXm/5mC7BVlhsBYKzGUoh6P7SFy3cskZw0cQRsOVT2GyG3qDzyAovgFsPUV1dEbccGM9Mk2WnyIRDLBt/FWA3IbW7j0QqOzy4suaYqeuCWRiI3oic6d6iaFOuGenmbbFkouBmayYoaAlk2/eEQGnKCH/uUnNUwfs/CjRnsbTca52PCiYH9HmQv1Yig/8NOlvgkp08BptEvj5C23F7YSinibEpK76wu7NGcJbTYpXfzpo4mzpTV2Y5S01rvOUKAC5rhpSHynNZP6EE6GkxysOw+jOS/C1Ba82n3/6B4ysTcfQ3IT31fmBKRuGwDuBnNdSFA1A== 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=9oXDIBGXs5l2VJ0a0gQKjxuZtcMnhHZqI4dSc7CPvDQ=; b=fW9plw821o+LM7F/APkGn/huux+SjMIGL+yqIu+fs/Ncmd+H75tX26jdCSUqmYM+CQtTknk9mcY7clvE21ZSsrqRTrmi5sDxclhrNJ2KA6xEIbmMFzBDkhR/3XoaHMauYkeNgIQ3nIlSACaVC98h2LcVEgW6nPTyszcPTY8mUxbsjluP8MpbuHV6ly5uIK7fLvOuvhAoQA3TYhlsT5h+TRUGuiPLT7aTyUvh6+UeTlf2oIi2Dsf/QQ0rQwDwacUQwI0egs6XE86qbroglHWttoSvOLzUlnjHNTNT76tl0n/AZjDJeLCfTdQ7fyE7EGImI+5oqLX+21RHnak9zPL8ag== 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=9oXDIBGXs5l2VJ0a0gQKjxuZtcMnhHZqI4dSc7CPvDQ=; b=P/a9qZLqr8ZGxanVRSy34DzzrEWG7h8CWFpV/fd7mLBT4yC6aNZMy+hjjxmxHPDAAmltF2EH+89PLI5VSMQG7mx1dUoxx4NnQYKRZyZREINjPvAltkdIEqpXGoJjzWU470istfq0AZMQTlbYZ2egNYa8ZN5HzuTMxmwlFL4SYoo= 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:51 +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:51 +0000 From: Liam Howlett To: "maple-tree@lists.infradead.org" , "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" , Andrew Morton Subject: [PATCH v5 44/70] fs/proc/task_mmu: Stop using linked list and highest_vm_end Thread-Topic: [PATCH v5 44/70] fs/proc/task_mmu: Stop using linked list and highest_vm_end Thread-Index: AQHYF959yCQXeHqUIEiI6rrKD9luNQ== Date: Wed, 2 Feb 2022 02:42:16 +0000 Message-ID: <20220202024137.2516438-45-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: 1a4eb053-58d5-4f76-c82f-08d9e5f5b515 x-ms-traffictypediagnostic: CO1PR10MB4801:EE_ x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:873; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 5DRvxc4eH2Bg11dp/KIbakjNQTlsL/AVHJNZk1LLkaC0VqtjrVlL5q4EbqP0XAzonOUqKAg35n+VzvDFjZaqkUarwL/a9/XrtdbL1RdAzKEMTa6wfY3EkMBUA7hLJkaZ/vKQ+A2DJCc+KvnyScXoRZjDr5m8QJIqpWpkG5/DrQaGAxBqoZwhgt0pootQ82mFf3HDw4jv+sp/C81Bsr7gvvEMWzndvkywikW7OZr+lfY9CCkfso+ds5ye0fgmn6nULyasD0X6z1vI3pHzutsPMRqwjjALa6FnHx3JWtigRn3z0eSygRpqd3cvxM6/grMumb8EtXMo7mviTd3UlO5rQxIyUSe64An9YhBXuphvRmqz/q8UFQPG+Q8Yf552hKZVNtxR7KbrAnCOvuWmePE6ow+4RxBf+yv8b0kzaZT2FWAn6jD6xCzXUIYyfi9kCDt033OAnSG4DTCXgdkWisPe0cHYyyyYYYz4GWCBDFdbwFQIhM+2Za9RhpvWHDKPjkGAfdCZs0cNwmmwwpFU3VUgl9VfyoMA05sXAQRP4pv7s1oBG1zXerTHfSiFrkaXT2FUx/lnvS7EB241IWGx7t0Aw8mvno0ZfZ+t+euSFouZmNSCabzajpJd2HM/veW31DR92FmJIyGHZmwnD0MRBBBe6IawsPLDtIGl44G9CmUx7FKp1dCiheoeeGTjAswBKuoeAJNmhzmP8I1oyBPMkRqQeA== 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?d4MbBHoEAnps1g0ekUo7BuB?= =?iso-8859-1?q?WvJH6cUKqYR79wX/4u7f7XuCOmfQJexMswNfoMaVWovnhZ2OZmevOMpYIi6z?= =?iso-8859-1?q?b8mkPr/H2s/JVwkWfQ0j3lCWozJqAb0FeW+0RfwpSijI31Isq9dKN3abUMgc?= =?iso-8859-1?q?Py7uUY93qWwwgDOsZuKaZ5S5770afmimPh0twU8s2z3qvrAbQTez6WSExXs9?= =?iso-8859-1?q?C9TGUnd0sxdInelRx96LXc9kN+ef8aUQH0l5bAs7/6DFonRtCvhXPi5YtAdc?= =?iso-8859-1?q?bZfsYF5sCZgoAA/BBa9gD4PXD/UH4C+vmtxhXH+M5GDEv4uOXbeFhSm8NpnW?= =?iso-8859-1?q?vgV2jOPmtbo+hRym5Fvuvxps4uIY8d5nM/Kaf3ngxTXpWHllQexpufWrJcGK?= =?iso-8859-1?q?3u9EfV4Nj5nYd+8cML2yCtmVOGIwMJqVMFheBysdQu8tTR8rYNgwFqAMSVF4?= =?iso-8859-1?q?dHX68N+NIyq70GWOzdIpA18avqiOY3yMH615Uax8k/9hI2UqnIqaEWIf56rU?= =?iso-8859-1?q?QlQnlQczHmeOL9ARv6UanylrH1BCjhOFDVMdAcPhXRm/LkGSIAoRAgKYHTnZ?= =?iso-8859-1?q?5jvkjH+MznMcpI/GUMqLEUIUhfNWxswzZvUcKoxN9OGr07uhhgjwwTrkqlcx?= =?iso-8859-1?q?xguhQrlobeFroSRE+uKvqTnxVL6pHKf4QMsyq6PI2DF87Uq1FQHHMU4VA3aA?= =?iso-8859-1?q?0W+cbawsMrzgpcCMUzMaM0glQaw1VjNovKM2fDNlnmQFqK+bQ2EXVetO0ogV?= =?iso-8859-1?q?xalEyHEdBiVj8Oc8fcJdPNPLxzRXXp9sNGzF3+wsncmWTIq/CwsPH6Tlr0A2?= =?iso-8859-1?q?er7NK96WcqOjnQRH7Hzg8KqgtvxVJJRDKzL4Qp7AEfKMMYX+B/snlOMJr8nx?= =?iso-8859-1?q?cE98qVWvUio2f3Ehzw5T1hNKcQ35LnXbuKGE3WxpqmaNSGAHW9ZsrUYAwpTF?= =?iso-8859-1?q?BwQK23h9HYgdO90rgQBfcv+X+Kp4xV1u+gug996mXdl+AGegML72awTAjNbE?= =?iso-8859-1?q?/boNfgsWu5S2kNIl8sGKASqQQJL0iN6UGvx52XxQCvy8Uctu8i4DqRe6FdSg?= =?iso-8859-1?q?fvFMTuAnBjG3AZbvOLBm8c2Au7MFyGH7Z6muTx75ddTYP4ohV4KsgEneKGoQ?= =?iso-8859-1?q?6PI9o1Kl3fEigmF0u/hi9ath/y/g6GyDN+I+QF3ioNSCtTReU7TTyBixKXen?= =?iso-8859-1?q?65iR0d25oIboKxNNPBrVe7X7zhbUlV/aLyef1kE3U4wEQbGUbeh8VTWrzmmV?= =?iso-8859-1?q?KE4eOUA4F0nwkpUQGSQI9sKt5/QczH+ldhVvizMdeQfzLBzKXG7dF9Z/AZ3L?= =?iso-8859-1?q?63eZ5J8jjM8bnSAjlfxbfa02ByF5aQoJ54Ezer9gb5fKIWW+iNaVzZgcjUD/?= =?iso-8859-1?q?kB++XcyUP9P2zLQm/tx1yzQ1htdGBrGpfQ9gvJq2Ll8Fp93P3vq0FZRy3qS9?= =?iso-8859-1?q?AecXSmYeK1AeIY9/Aa1V6n3xH4mBo6Sfm9CS+B/veFolh++Z2yjCQ++FM8Cy?= =?iso-8859-1?q?PRrtykPbzQHcqIwcu6ziK2HKafTr5/3xuGfDHnfW1CTRQKC7qcTD4jgjROyt?= =?iso-8859-1?q?Z9RmymwVqu7VKZRl6sw+THqx6b0XDf/1aipWyoemQqe4UJLZBcY6YGA384id?= =?iso-8859-1?q?RHe5zRITGalHZlHFXfCoLkpiQzhz73SR9rb1NorT0LjVJ7ERumDo2F9Tv4pA?= =?iso-8859-1?q?=3D?= 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: 1a4eb053-58d5-4f76-c82f-08d9e5f5b515 X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Feb 2022 02:42:16.7042 (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: K4zAZQDhsmed2x9R8gjgOaXebligUhD+HMP/ctmXQp1fasIqTHTHlb1z/jVvDXSkwFz+jfQIRXtGN39oaYJoDA== 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-ORIG-GUID: 1pXA_oiO-ekVFvehmX4U-MebydhtoJn1 X-Proofpoint-GUID: 1pXA_oiO-ekVFvehmX4U-MebydhtoJn1 X-Stat-Signature: cx58umsmiwn79gfi7bfexpi3amabdioj X-Rspam-User: nil Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2021-07-09 header.b=NVzo+hwJ; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b="P/a9qZLq"; spf=none (imf17.hostedemail.com: domain of liam.howlett@oracle.com has no SPF policy when checking 205.220.177.32) smtp.mailfrom=liam.howlett@oracle.com; dmarc=pass (policy=none) header.from=oracle.com X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 8E90040002 X-HE-Tag: 1643778445-342158 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: From: "Matthew Wilcox (Oracle)" Remove references to mm_struct linked list and highest_vm_end for when they are removed Signed-off-by: Matthew Wilcox (Oracle) Signed-off-by: Liam R. Howlett --- fs/proc/internal.h | 2 +- fs/proc/task_mmu.c | 73 ++++++++++++++++++++++++++-------------------- 2 files changed, 42 insertions(+), 33 deletions(-) diff --git a/fs/proc/internal.h b/fs/proc/internal.h index 06a80f78433d..f03000764ce5 100644 --- a/fs/proc/internal.h +++ b/fs/proc/internal.h @@ -285,7 +285,7 @@ struct proc_maps_private { struct task_struct *task; struct mm_struct *mm; #ifdef CONFIG_MMU - struct vm_area_struct *tail_vma; + struct vma_iterator iter; #endif #ifdef CONFIG_NUMA struct mempolicy *task_mempolicy; diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index f57a98a39152..bf87258dfb68 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c @@ -123,12 +123,26 @@ static void release_task_mempolicy(struct proc_maps_private *priv) } #endif +static struct vm_area_struct *proc_get_vma(struct proc_maps_private *priv, + loff_t *ppos) +{ + struct vm_area_struct *vma = vma_next(&priv->iter); + + if (vma) { + *ppos = vma->vm_start; + } else { + *ppos = -2UL; + vma = get_gate_vma(priv->mm); + } + + return vma; +} + static void *m_start(struct seq_file *m, loff_t *ppos) { struct proc_maps_private *priv = m->private; unsigned long last_addr = *ppos; struct mm_struct *mm; - struct vm_area_struct *vma; /* See m_next(). Zero at the start or after lseek. */ if (last_addr == -1UL) @@ -152,31 +166,21 @@ static void *m_start(struct seq_file *m, loff_t *ppos) return ERR_PTR(-EINTR); } + vma_iter_init(&priv->iter, mm, last_addr); hold_task_mempolicy(priv); - priv->tail_vma = get_gate_vma(mm); - - vma = find_vma(mm, last_addr); - if (vma) - return vma; + if (last_addr == -2UL) + return get_gate_vma(mm); - return priv->tail_vma; + return proc_get_vma(priv, ppos); } static void *m_next(struct seq_file *m, void *v, loff_t *ppos) { - struct proc_maps_private *priv = m->private; - struct vm_area_struct *next, *vma = v; - - if (vma == priv->tail_vma) - next = NULL; - else if (vma->vm_next) - next = vma->vm_next; - else - next = priv->tail_vma; - - *ppos = next ? next->vm_start : -1UL; - - return next; + if (*ppos == -2UL) { + *ppos = -1UL; + return NULL; + } + return proc_get_vma(m->private, ppos); } static void m_stop(struct seq_file *m, void *v) @@ -854,16 +858,16 @@ static int show_smaps_rollup(struct seq_file *m, void *v) { struct proc_maps_private *priv = m->private; struct mem_size_stats mss; - struct mm_struct *mm; + struct mm_struct *mm = priv->mm; struct vm_area_struct *vma; - unsigned long last_vma_end = 0; + unsigned long vma_start = 0, last_vma_end = 0; int ret = 0; + MA_STATE(mas, &mm->mm_mt, 0, 0); priv->task = get_proc_task(priv->inode); if (!priv->task) return -ESRCH; - mm = priv->mm; if (!mm || !mmget_not_zero(mm)) { ret = -ESRCH; goto out_put_task; @@ -876,8 +880,13 @@ static int show_smaps_rollup(struct seq_file *m, void *v) goto out_put_mm; hold_task_mempolicy(priv); + vma = mas_find(&mas, 0); + + if (unlikely(!vma)) + goto empty_set; - for (vma = priv->mm->mmap; vma;) { + vma_start = vma->vm_start; + do { smap_gather_stats(vma, &mss, 0); last_vma_end = vma->vm_end; @@ -886,6 +895,7 @@ static int show_smaps_rollup(struct seq_file *m, void *v) * access it for write request. */ if (mmap_lock_is_contended(mm)) { + mas_pause(&mas); mmap_read_unlock(mm); ret = mmap_read_lock_killable(mm); if (ret) { @@ -929,7 +939,7 @@ static int show_smaps_rollup(struct seq_file *m, void *v) * contains last_vma_end. * Iterate VMA' from last_vma_end. */ - vma = find_vma(mm, last_vma_end - 1); + vma = mas_find(&mas, ULONG_MAX); /* Case 3 above */ if (!vma) break; @@ -943,11 +953,10 @@ static int show_smaps_rollup(struct seq_file *m, void *v) smap_gather_stats(vma, &mss, last_vma_end); } /* Case 2 above */ - vma = vma->vm_next; - } + } while ((vma = mas_find(&mas, ULONG_MAX)) != NULL); - show_vma_header_prefix(m, priv->mm->mmap->vm_start, - last_vma_end, 0, 0, 0, 0); +empty_set: + show_vma_header_prefix(m, vma_start, last_vma_end, 0, 0, 0, 0); seq_pad(m, ' '); seq_puts(m, "[rollup]\n"); @@ -1240,6 +1249,7 @@ static ssize_t clear_refs_write(struct file *file, const char __user *buf, return -ESRCH; mm = get_task_mm(task); if (mm) { + MA_STATE(mas, &mm->mm_mt, 0, 0); struct mmu_notifier_range range; struct clear_refs_private cp = { .type = type, @@ -1259,7 +1269,7 @@ static ssize_t clear_refs_write(struct file *file, const char __user *buf, } if (type == CLEAR_REFS_SOFT_DIRTY) { - for (vma = mm->mmap; vma; vma = vma->vm_next) { + mas_for_each(&mas, vma, ULONG_MAX) { if (!(vma->vm_flags & VM_SOFTDIRTY)) continue; vma->vm_flags &= ~VM_SOFTDIRTY; @@ -1271,8 +1281,7 @@ static ssize_t clear_refs_write(struct file *file, const char __user *buf, 0, NULL, mm, 0, -1UL); mmu_notifier_invalidate_range_start(&range); } - walk_page_range(mm, 0, mm->highest_vm_end, &clear_refs_walk_ops, - &cp); + walk_page_range(mm, 0, -1, &clear_refs_walk_ops, &cp); if (type == CLEAR_REFS_SOFT_DIRTY) { mmu_notifier_invalidate_range_end(&range); flush_tlb_mm(mm);