From patchwork Thu May 18 14:55:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Liam R. Howlett" X-Patchwork-Id: 13246945 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 EDEA0C7EE23 for ; Thu, 18 May 2023 14:56:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A3D1E280006; Thu, 18 May 2023 10:56:40 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9ECA3280004; Thu, 18 May 2023 10:56:40 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7CA52280006; Thu, 18 May 2023 10:56:40 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 65F11280004 for ; Thu, 18 May 2023 10:56:40 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 060D0AE219 for ; Thu, 18 May 2023 14:56:40 +0000 (UTC) X-FDA: 80803677360.01.276280E Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by imf08.hostedemail.com (Postfix) with ESMTP id 8B691160015 for ; Thu, 18 May 2023 14:56:36 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-03-30 header.b=VC2L+Vcr; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=0R8BP09w; spf=pass (imf08.hostedemail.com: domain of liam.howlett@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=liam.howlett@oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); dmarc=pass (policy=none) header.from=oracle.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1684421796; 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=jgzmmTEKWB0i9WIDRw5vqMkC751jSozh6uHq83GAlk4=; b=3EeAkKLnX8nXW9tFZMUcnfoK3BPBeT2M1HZ5drHK93t6SGYGpIVeegncqYlMu4Xb8VBQIz IGyA+5HhXtHi5NsTq3dtWJC50BlvBm5eFUANKaXBRtRPNelR8In4ms8SP+jZMUKsajSpsi kxANV5A2IMcYY8C0jWReuCarwx8B7OM= ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1684421796; a=rsa-sha256; cv=pass; b=QuUx6TF6djBH034pXKoUaPayBqLWJHBzMK9xjwm4/WhGQCpySylH/JIROOSZ8VgVt8avq6 pxqCFFOlizOuYcQ6WZO3jIqLyBHA8ReH/y23D0jMKVHUJ1ZgHnS5YtB6iM1a3icXvS9HwE d4EPhA4fGSBa7x0Lt/9E2iamf3W0QCk= ARC-Authentication-Results: i=2; imf08.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-03-30 header.b=VC2L+Vcr; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=0R8BP09w; spf=pass (imf08.hostedemail.com: domain of liam.howlett@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=liam.howlett@oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); dmarc=pass (policy=none) header.from=oracle.com Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 34I6IrCb028533; Thu, 18 May 2023 14:56:35 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-03-30; bh=jgzmmTEKWB0i9WIDRw5vqMkC751jSozh6uHq83GAlk4=; b=VC2L+VcrC7WzM+4LH4i8df29aNJ3iplg8P8ZbAOqAkBELEb9Oz9A1O/cBgj1tOAhWzPw mO4Ejk6QUEdFNqsYVD341lM/NUUlDShibj1eF/Fnua+/eBaYMZWu4mDVr3b4fO1cHuO/ +ysgPLCIGVl1zIbZ/c2STX1w9kV5FfARbvCcuT9iMnU6DmLhmTLsUAAzbMKhUzuMo691 uYSjpHyJWnXBoEM76MJOyxdEPFRGwVAibrnblKtRx+TPak0kPKOG4SSpg10cVbQZU5bg fiARZzriec3xOI8tQ/BTSaG9ln1P0DmfvNIh63uWmfELpaTS4LszUovjvknGTSUx/5nV Dg== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3qj1fc8f9c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 18 May 2023 14:56:35 +0000 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 34IE2jRt025047; Thu, 18 May 2023 14:56:34 GMT Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2102.outbound.protection.outlook.com [104.47.55.102]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3qj106vmg2-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 18 May 2023 14:56:34 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KqYkF1GKeYgayPmn8YAtC9CXx3d9PKt0yT1SPHbSH15iMOsHcrsXR52N0i6X4X3DegpKsE0bSKF60gEzFInnUNGAouVEFPoroYHBG1HO1aYbUGd7ikmhZ5ZjcsLXESg+8iQVBzOph+SPdGq/o4dMXeebNRr6Q2QomIwNWzHptBs569/bjWAhNZzIy7wqln1pcYdC0SN/mUURJWTnSpVEfa3pdqFnrlAk6cQeZCS7UOBVHoTGDO6XcufyLminaVsq2uWPFVDCmxchEVeDlt/GOaqfyQoQ+GRn/CbRASOrLyONkSjk2uzuMLstFruc4z9jpFo6yN9/v03sjRuTYoDSYA== 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=jgzmmTEKWB0i9WIDRw5vqMkC751jSozh6uHq83GAlk4=; b=f8maN9mvqxHhKFko/bHRuD3WWmmo7y5JbdaRrsWXa612QAO6gc/Tiq0KXfgpw+L62/hZjdjIGYNVu6CTV0nyB9b9G1jwpKPsaL3FyYxL5EKB4+UVtrhxmLbDW1v4m4znZTmIvIvk096qDXJWzZOVko1U1tM0E8z5MjyTGfzHjciciLo1HwRZWJ4rLOahnu/cspShlJfFkFBc81Y66PeQMHnbCJJsTVFYbnHnbEwrLn+fyh7rPG55WTHoYtUpJurWj6hh4JCByu/OqlDaIyJ6Suet5I5vw4q7W8IKO2wW8LCP+YdKhYGs2tLaiOSWvnxZn7tTDJhAmn20JhBBZVUxhg== 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=jgzmmTEKWB0i9WIDRw5vqMkC751jSozh6uHq83GAlk4=; b=0R8BP09wa2lZAJmKXApwO6FiUIOU1VVCQeQ/fAV0aBv+MVNoEpYhvtShVlbyWr+cuHzjy5VhKQxSdRYq40HVjy6BiFHB+jQDjOv7VQYyGd/sTwFsyjKuWkRaExusQut52uAMYAMUNCp5YwT/f+mIpLbnnlFjuUDEd3eQj+9FooA= Received: from SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) by DM4PR10MB7427.namprd10.prod.outlook.com (2603:10b6:8:181::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.17; Thu, 18 May 2023 14:56:30 +0000 Received: from SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::998f:d221:5fb6:c67d]) by SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::998f:d221:5fb6:c67d%7]) with mapi id 15.20.6411.017; Thu, 18 May 2023 14:56:30 +0000 From: "Liam R. Howlett" To: Andrew Morton Cc: maple-tree@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Liam R. Howlett" Subject: [PATCH v4 17/35] mm: Update validate_mm() to use vma iterator Date: Thu, 18 May 2023 10:55:26 -0400 Message-Id: <20230518145544.1722059-18-Liam.Howlett@oracle.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230518145544.1722059-1-Liam.Howlett@oracle.com> References: <20230518145544.1722059-1-Liam.Howlett@oracle.com> X-ClientProxiedBy: YT4PR01CA0137.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:d5::24) To SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN6PR10MB3022:EE_|DM4PR10MB7427:EE_ X-MS-Office365-Filtering-Correlation-Id: b43756ac-f4c4-49e1-bedf-08db57b0102b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: lLRnoW39v3Q9ppxPaQKXOWfYQSlOGmWrly3JVcTga3lKimcA7lq3Z9e7BdGLA7WCNt9oyoHRvmUFKRoN+N1v2/N5zKFQofp6xdFkSJz9V4l1+dwXVjYtTxcEPSMxP2XgOc3fhV0P6FAFzort/0AzyfhuhoeI2E858xnqV4hIucrl/ISmxO0vMiceUwVT/4lB/A5k3JK/dwTJwpJFiflmHsu00ram/4CtlOdzuBAwZBm3S6/HiCNN3OhijNL4dAgRXouy0AMpCFalxclcctd4NjGFrSRgo+PChKs88venurnZf5CibxTpDpsAsT6C2GeVVpwkCRCNgSDNn+88sscs3S0pF94xSNxsp1Hz2GtYTfLiFqIYtGi9/rTVwj3CzneSw/LwF+C5qAGc2OW5NDAJhPjnrV4q0hmX68apZbRjhDCunm6ZIn2q6iUCCdkov/qvM5qSPa+zuUtkWYXb9UCw6sIwzoyk/lVim2tofUKhhOFRJWOG1LNsgUt/O0r4sq143H/V+oKR4hlFVlMc/2Dc9lRg2bHK2m7MfIlgWuu+C/1+lJp/f3Q5a4qBr6727n+g 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:(13230028)(39860400002)(396003)(346002)(136003)(376002)(366004)(451199021)(8676002)(5660300002)(8936002)(4326008)(316002)(6512007)(1076003)(83380400001)(6506007)(26005)(107886003)(86362001)(186003)(38100700002)(2616005)(41300700001)(478600001)(66476007)(6666004)(66946007)(66556008)(6916009)(6486002)(36756003)(2906002)(15650500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: JO3nxuezhTFc78H7pJw7yssS43h6TSe/r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6UxH1JufdCDJ7Ee3jTmeHTrQNeJJnzKwBj0MiJo7cu7oVmyHShL/8PAZFRuSTyigTA5dzs/1lpSvTxdcLaUtBplSueLXiGCONfBoBjZ8KQqLf7MJxAReHmjHeTCgH7fZMMVjk7SG50KxRHJThe9UQ7lkBCRbVG3ohr8bsE7JrnnP9+qptngb+5Blr7hcwsJzx3D9o8CMMXEbiChIuZwrlkT5FQ+t1uvF8UVLUhptQEs29JOXeMCPvKcmB1Xa5Ks+XUV6ivmTWbfmvPS4+0OV2M41VOa4Lzmub7FxYpT+K8Pt3YpCKepoEcPh8t0HpYe4R4Ht8frplMzgfAbSv2nrQcAViJ35JqBzCWQLBzMhc/WjfEkichybu9X5HuNp9N9uIvYJX3ytB96svqTkR+dvb6/yhvEoYYsW46LZ204M+0Lg== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: b43756ac-f4c4-49e1-bedf-08db57b0102b X-MS-Exchange-CrossTenant-AuthSource: SN6PR10MB3022.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 May 2023 14:56:30.1797 (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: RVCvdD3lTANcAh5bcTyM9xQIgeFMsVAz4hHoH/n0vUkG340bcApVES86ftSQbdnnevz7QtXxXSPeTVuBjCgowg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR10MB7427 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-05-18_11,2023-05-17_02,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 mlxscore=0 phishscore=0 mlxlogscore=999 spamscore=0 adultscore=0 malwarescore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2304280000 definitions=main-2305180120 X-Proofpoint-ORIG-GUID: CggSIR-pyJfj6SW50aFit6UDWGN4iRpe X-Proofpoint-GUID: CggSIR-pyJfj6SW50aFit6UDWGN4iRpe X-Stat-Signature: 1ciiaqabujh8a8fhzxuuf63drb3sg9zh X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 8B691160015 X-Rspam-User: X-HE-Tag: 1684421796-396374 X-HE-Meta: U2FsdGVkX18SC+Sf8NsIM1gwVLIdHNYD16oYclfkgsVEvrKZlqnsJsk5/ud03fy4BBj+eT2nSlgHpycLB63BXClIoJSicTgqCDplk7x0cZTgwbmA4dbUa+a82rfo8mIHmvTD2iwN5sgRhi4KkFDgBJBQyxAbjXL3JNchd01VV5Xnd+B2Q5X+RC9gIc0lvjyaFWQeh4y6WXzaJusRqkZqvFFFvItQAxsVJ8H/5c9PHituxEX3YgGQx8YQBlxaMF6fOo+Dy104lQVNLFmSvWJWqUfwzVU5D4xPWFpkjh7DPhFciDj+k7omlF4zNqsdB/4viVRT3jOaEuHFi+KNqCaSjyDiBcHDcZ0EU2KhYH9ovD4TX/mGiw/6vL7BNSN8wGKh3hnHtVVNURXMpUB6Rjfr6uHd0P/qsDSRAs0GBlbpJ/33k0EM1fZ4sHjzFDW5vaj99x5hNot9cHdNLvGlSfCc7jKGUxz9G9mQsioxJQlGRxXQfE0r4khsaZpBdJBjV905ISC30t541CibaOHv9NPitT8O1V62z21QxKmsi1DUm8yJy2hbh9eBQmhhpB0FsWE3vuVxy9q7VsLEsL475dv+wNL5HytPCRzYdDMkvH2DCBixT2LrlCsjxmxU2RkllRRSF993sn3bmjZ6d7tb1z6/PO0JwJJuFIeeDWdpZrf/ky9lO6jj1Wz36A6Q1khdBWjjNAlEkiBcCILC2BFGs9T3FFJxjkvPwaBpyZchUu+pn2+SF7Pk0nJGf+W4+2igNjgQlR3XXPFSdV+/qxzW/I9ILwI8EExqfBrBsOPPzXVYqBZ6tXwMv/AyGXe6jPz61G/b1JL5+UrRTorGTXKfzbgr0LkZ9udOV7FHm7E3OrwpgQRGrHwsBNpLL3NAC7xd7tQV7dzcaJXy6A7AB0KtxBDwG0SWe2fwxul+gTu9pH+Kjk3hWQ83lXhUsF8D4V+F3ILCZpOZV+wKPrcBzxxUitg XxpBfME8 KuW3cZglicdZLIMb1ymksbxRMU9mV/KsaamnSexbVWp4LkJRiKhlL81Gx4hIQzsoEPtD+lWoOXsKh0KykKxo+gh9Fg7PuOPavyeNwwNJePty1zBQvnfPDlVgDwHn3xy6mTAN2nP0Hn+Ov6A2COFNA2Giup7dXMqQmCi3uszj6Q97Rp7HBGBOD6MX5Us7Wfgdmuf95UFdhgDhpuQgm+dFsNWMOql9f21da19lhbwGHFAIrpLVB1hRJHffst1e/4yD3R6PMmbsekLrCuJIthmn2JkmBlCZDXtwEd3j76nTqJInshO3qHxpu605cYpY/XyvkxXQSX+8Rugi2m8bVsdmkcbbe/CBek8CQaD0q9dVhW3e3MRS8ROXczFCZ79Hh1nCBR+DpqS5MyVleRlzkMqShmFdaDqBhZ6Y8Jwp0eFh8zs/XwXw= 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: Use the vma iterator in the validation code and combine the code to check the maple tree into the main validate_mm() function. Introduce a new function vma_iter_dump_tree() to dump the maple tree in hex layout. Replace all calls to validate_mm_mt() with validate_mm(). Signed-off-by: Liam R. Howlett --- include/linux/mmdebug.h | 14 ++++++ mm/debug.c | 9 ++++ mm/internal.h | 3 +- mm/mmap.c | 101 ++++++++++++++++------------------------ 4 files changed, 66 insertions(+), 61 deletions(-) diff --git a/include/linux/mmdebug.h b/include/linux/mmdebug.h index b8728d11c949..7c3e7b0b0e8f 100644 --- a/include/linux/mmdebug.h +++ b/include/linux/mmdebug.h @@ -8,10 +8,12 @@ struct page; struct vm_area_struct; struct mm_struct; +struct vma_iterator; void dump_page(struct page *page, const char *reason); void dump_vma(const struct vm_area_struct *vma); void dump_mm(const struct mm_struct *mm); +void vma_iter_dump_tree(const struct vma_iterator *vmi); #ifdef CONFIG_DEBUG_VM #define VM_BUG_ON(cond) BUG_ON(cond) @@ -74,6 +76,17 @@ void dump_mm(const struct mm_struct *mm); } \ unlikely(__ret_warn_once); \ }) +#define VM_WARN_ON_ONCE_MM(cond, mm) ({ \ + static bool __section(".data.once") __warned; \ + int __ret_warn_once = !!(cond); \ + \ + if (unlikely(__ret_warn_once && !__warned)) { \ + dump_mm(mm); \ + __warned = true; \ + WARN_ON(1); \ + } \ + unlikely(__ret_warn_once); \ +}) #define VM_WARN_ON(cond) (void)WARN_ON(cond) #define VM_WARN_ON_ONCE(cond) (void)WARN_ON_ONCE(cond) @@ -90,6 +103,7 @@ void dump_mm(const struct mm_struct *mm); #define VM_WARN_ON_ONCE_PAGE(cond, page) BUILD_BUG_ON_INVALID(cond) #define VM_WARN_ON_FOLIO(cond, folio) BUILD_BUG_ON_INVALID(cond) #define VM_WARN_ON_ONCE_FOLIO(cond, folio) BUILD_BUG_ON_INVALID(cond) +#define VM_WARN_ON_ONCE_MM(cond, mm) BUILD_BUG_ON_INVALID(cond) #define VM_WARN_ONCE(cond, format...) BUILD_BUG_ON_INVALID(cond) #define VM_WARN(cond, format...) BUILD_BUG_ON_INVALID(cond) #endif diff --git a/mm/debug.c b/mm/debug.c index c7b228097bd9..ee533a5ceb79 100644 --- a/mm/debug.c +++ b/mm/debug.c @@ -268,4 +268,13 @@ void page_init_poison(struct page *page, size_t size) if (page_init_poisoning) memset(page, PAGE_POISON_PATTERN, size); } + +void vma_iter_dump_tree(const struct vma_iterator *vmi) +{ +#if defined(CONFIG_DEBUG_VM_MAPLE_TREE) + mas_dump(&vmi->mas); + mt_dump(vmi->mas.tree, mt_dump_hex); +#endif /* CONFIG_DEBUG_VM_MAPLE_TREE */ +} + #endif /* CONFIG_DEBUG_VM */ diff --git a/mm/internal.h b/mm/internal.h index 4c195920f565..8d1a8bd00124 100644 --- a/mm/internal.h +++ b/mm/internal.h @@ -1051,13 +1051,14 @@ static inline void vma_iter_store(struct vma_iterator *vmi, printk("%lu > %lu\n", vmi->mas.index, vma->vm_start); printk("store of vma %lu-%lu", vma->vm_start, vma->vm_end); printk("into slot %lu-%lu", vmi->mas.index, vmi->mas.last); - mt_dump(vmi->mas.tree, mt_dump_hex); + vma_iter_dump_tree(vmi); } if (WARN_ON(vmi->mas.node != MAS_START && vmi->mas.last < vma->vm_start)) { printk("%lu < %lu\n", vmi->mas.last, vma->vm_start); printk("store of vma %lu-%lu", vma->vm_start, vma->vm_end); printk("into slot %lu-%lu", vmi->mas.index, vmi->mas.last); mt_dump(vmi->mas.tree, mt_dump_hex); + vma_iter_dump_tree(vmi); } #endif diff --git a/mm/mmap.c b/mm/mmap.c index 76eaf12f1390..bcebfd926632 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -299,62 +299,44 @@ SYSCALL_DEFINE1(brk, unsigned long, brk) return origbrk; } -#if defined(CONFIG_DEBUG_VM_MAPLE_TREE) -extern void mt_validate(struct maple_tree *mt); -extern void mt_dump(const struct maple_tree *mt, enum mt_dump_format fmt); - -/* Validate the maple tree */ -static void validate_mm_mt(struct mm_struct *mm) -{ - struct maple_tree *mt = &mm->mm_mt; - struct vm_area_struct *vma_mt; - - MA_STATE(mas, mt, 0, 0); - - mt_validate(&mm->mm_mt); - mas_for_each(&mas, vma_mt, ULONG_MAX) { - if ((vma_mt->vm_start != mas.index) || - (vma_mt->vm_end - 1 != mas.last)) { - pr_emerg("issue in %s\n", current->comm); - dump_stack(); - dump_vma(vma_mt); - pr_emerg("mt piv: %p %lu - %lu\n", vma_mt, - mas.index, mas.last); - pr_emerg("mt vma: %p %lu - %lu\n", vma_mt, - vma_mt->vm_start, vma_mt->vm_end); - - mt_dump(mas.tree, mt_dump_hex); - if (vma_mt->vm_end != mas.last + 1) { - pr_err("vma: %p vma_mt %lu-%lu\tmt %lu-%lu\n", - mm, vma_mt->vm_start, vma_mt->vm_end, - mas.index, mas.last); - mt_dump(mas.tree, mt_dump_hex); - } - VM_BUG_ON_MM(vma_mt->vm_end != mas.last + 1, mm); - if (vma_mt->vm_start != mas.index) { - pr_err("vma: %p vma_mt %p %lu - %lu doesn't match\n", - mm, vma_mt, vma_mt->vm_start, vma_mt->vm_end); - mt_dump(mas.tree, mt_dump_hex); - } - VM_BUG_ON_MM(vma_mt->vm_start != mas.index, mm); - } - } -} - +#if defined(CONFIG_DEBUG_VM) static void validate_mm(struct mm_struct *mm) { int bug = 0; int i = 0; struct vm_area_struct *vma; - MA_STATE(mas, &mm->mm_mt, 0, 0); + VMA_ITERATOR(vmi, mm, 0); - validate_mm_mt(mm); +#if defined(CONFIG_DEBUG_VM_MAPLE_TREE) + mt_validate(&mm->mm_mt); +#endif - mas_for_each(&mas, vma, ULONG_MAX) { + for_each_vma(vmi, vma) { #ifdef CONFIG_DEBUG_VM_RB struct anon_vma *anon_vma = vma->anon_vma; struct anon_vma_chain *avc; +#endif + unsigned long vmi_start, vmi_end; + bool warn = 0; + + vmi_start = vma_iter_addr(&vmi); + vmi_end = vma_iter_end(&vmi); + if (VM_WARN_ON_ONCE_MM(vma->vm_end != vmi_end, mm)) + warn = 1; + + if (VM_WARN_ON_ONCE_MM(vma->vm_start != vmi_start, mm)) + warn = 1; + + if (warn) { + pr_emerg("issue in %s\n", current->comm); + dump_stack(); + dump_vma(vma); + pr_emerg("tree range: %px start %lx end %lx\n", vma, + vmi_start, vmi_end - 1); + vma_iter_dump_tree(&vmi); + } +#ifdef CONFIG_DEBUG_VM_RB if (anon_vma) { anon_vma_lock_read(anon_vma); list_for_each_entry(avc, &vma->anon_vma_chain, same_vma) @@ -365,16 +347,15 @@ static void validate_mm(struct mm_struct *mm) i++; } if (i != mm->map_count) { - pr_emerg("map_count %d mas_for_each %d\n", mm->map_count, i); + pr_emerg("map_count %d vma iterator %d\n", mm->map_count, i); bug = 1; } VM_BUG_ON_MM(bug, mm); } -#else /* !CONFIG_DEBUG_VM_MAPLE_TREE */ -#define validate_mm_mt(root) do { } while (0) +#else /* !CONFIG_DEBUG_VM */ #define validate_mm(mm) do { } while (0) -#endif /* CONFIG_DEBUG_VM_MAPLE_TREE */ +#endif /* CONFIG_DEBUG_VM */ /* * vma has some anon_vma assigned, and is already inserted on that @@ -2261,7 +2242,7 @@ int __split_vma(struct vma_iterator *vmi, struct vm_area_struct *vma, struct vm_area_struct *new; int err; - validate_mm_mt(vma->vm_mm); + validate_mm(vma->vm_mm); WARN_ON(vma->vm_start >= addr); WARN_ON(vma->vm_end <= addr); @@ -2319,7 +2300,7 @@ int __split_vma(struct vma_iterator *vmi, struct vm_area_struct *vma, /* Success. */ if (new_below) vma_next(vmi); - validate_mm_mt(vma->vm_mm); + validate_mm(vma->vm_mm); return 0; out_free_mpol: @@ -2328,7 +2309,7 @@ int __split_vma(struct vma_iterator *vmi, struct vm_area_struct *vma, vma_iter_free(vmi); out_free_vma: vm_area_free(new); - validate_mm_mt(vma->vm_mm); + validate_mm(vma->vm_mm); return err; } @@ -2963,7 +2944,7 @@ int do_vma_munmap(struct vma_iterator *vmi, struct vm_area_struct *vma, arch_unmap(mm, start, end); ret = do_vmi_align_munmap(vmi, vma, mm, start, end, uf, downgrade); - validate_mm_mt(mm); + validate_mm(mm); return ret; } @@ -2985,7 +2966,7 @@ static int do_brk_flags(struct vma_iterator *vmi, struct vm_area_struct *vma, struct mm_struct *mm = current->mm; struct vma_prepare vp; - validate_mm_mt(mm); + validate_mm(mm); /* * Check against address space limits by the changed size * Note: This happens *after* clearing old mappings in some code paths. @@ -3226,7 +3207,7 @@ struct vm_area_struct *copy_vma(struct vm_area_struct **vmap, bool faulted_in_anon_vma = true; VMA_ITERATOR(vmi, mm, addr); - validate_mm_mt(mm); + validate_mm(mm); /* * If anonymous vma has not yet been faulted, update new pgoff * to match new location, to increase its chance of merging. @@ -3285,7 +3266,7 @@ struct vm_area_struct *copy_vma(struct vm_area_struct **vmap, goto out_vma_link; *need_rmap_locks = false; } - validate_mm_mt(mm); + validate_mm(mm); return new_vma; out_vma_link: @@ -3301,7 +3282,7 @@ struct vm_area_struct *copy_vma(struct vm_area_struct **vmap, out_free_vma: vm_area_free(new_vma); out: - validate_mm_mt(mm); + validate_mm(mm); return NULL; } @@ -3438,7 +3419,7 @@ static struct vm_area_struct *__install_special_mapping( int ret; struct vm_area_struct *vma; - validate_mm_mt(mm); + validate_mm(mm); vma = vm_area_alloc(mm); if (unlikely(vma == NULL)) return ERR_PTR(-ENOMEM); @@ -3461,12 +3442,12 @@ static struct vm_area_struct *__install_special_mapping( perf_event_mmap(vma); - validate_mm_mt(mm); + validate_mm(mm); return vma; out: vm_area_free(vma); - validate_mm_mt(mm); + validate_mm(mm); return ERR_PTR(ret); }