From mboxrd@z Thu Jan 1 00:00:00 1970 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 E1886CCA484 for ; Mon, 6 Jun 2022 12:26:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 17C256B0071; Mon, 6 Jun 2022 08:26:16 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1286F6B0073; Mon, 6 Jun 2022 08:26:16 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EE5236B0074; Mon, 6 Jun 2022 08:26:15 -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 DB69F6B0071 for ; Mon, 6 Jun 2022 08:26:15 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay13.hostedemail.com (Postfix) with ESMTP id A79396051E for ; Mon, 6 Jun 2022 12:26:15 +0000 (UTC) X-FDA: 79547733510.17.0E61F1F Received: from alexa-out-sd-02.qualcomm.com (alexa-out-sd-02.qualcomm.com [199.106.114.39]) by imf03.hostedemail.com (Postfix) with ESMTP id 59CAF20062 for ; Mon, 6 Jun 2022 12:25:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1654518374; x=1686054374; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=1r4i7S693eNGdvCLoo3S36nunc2SGIhjZFlXs94KVRg=; b=sdAwZoKDSFcS1w5o+9XRppLlcUToTnT/zHdsLArT0ewH+zci8PoWCK7W K9U6vcyCfUW0o75YDxOEBH2OtUT8bOKuoCptUaGnpImqWXIfdSpCMNMED hzJ+PXe66wXVzdZPT7WHME9pVvd6S6kyeoeByaSY8hAefJVIfNluD/mkP 4=; Received: from unknown (HELO ironmsg02-sd.qualcomm.com) ([10.53.140.142]) by alexa-out-sd-02.qualcomm.com with ESMTP; 06 Jun 2022 05:26:13 -0700 X-QCInternal: smtphost Received: from nasanex01c.na.qualcomm.com ([10.47.97.222]) by ironmsg02-sd.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jun 2022 05:26:13 -0700 Received: from nalasex01a.na.qualcomm.com (10.47.209.196) by nasanex01c.na.qualcomm.com (10.47.97.222) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Mon, 6 Jun 2022 05:26:13 -0700 Received: from qian (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Mon, 6 Jun 2022 05:26:12 -0700 Date: Mon, 6 Jun 2022 08:26:10 -0400 From: Qian Cai To: Liam Howlett CC: "maple-tree@lists.infradead.org" , "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" , Andrew Morton Subject: Re: [PATCH v9 08/69] mm: start tracking VMAs with maple tree Message-ID: References: <20220504010716.661115-1-Liam.Howlett@oracle.com> <20220504010716.661115-10-Liam.Howlett@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20220504010716.661115-10-Liam.Howlett@oracle.com> X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01a.na.qualcomm.com (10.47.209.196) X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 59CAF20062 X-Stat-Signature: 4srkefgo9fws3xfcrpe9mtbng81z1cji X-Rspam-User: Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=quicinc.com header.s=qcdkim header.b=sdAwZoKD; spf=pass (imf03.hostedemail.com: domain of quic_qiancai@quicinc.com designates 199.106.114.39 as permitted sender) smtp.mailfrom=quic_qiancai@quicinc.com; dmarc=pass (policy=none) header.from=quicinc.com X-HE-Tag: 1654518358-876829 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: On Wed, May 04, 2022 at 01:07:52AM +0000, Liam Howlett wrote: > From: "Liam R. Howlett" > > Start tracking the VMAs with the new maple tree structure in parallel with > the rb_tree. Add debug and trace events for maple tree operations and > duplicate the rb_tree that is created on forks into the maple tree. > > The maple tree is added to the mm_struct including the mm_init struct, > added support in required mm/mmap functions, added tracking in kernel/fork > for process forking, and used to find the unmapped_area and checked > against what the rbtree finds. > > This also moves the mmap_lock() in exit_mmap() since the oom reaper call > does walk the VMAs. Otherwise lockdep will be unhappy if oom happens. > > Signed-off-by: Liam R. Howlett > Signed-off-by: Matthew Wilcox (Oracle) ... > @@ -842,6 +969,12 @@ int __vma_adjust(struct vm_area_struct *vma, unsigned long start, > again: > vma_adjust_trans_huge(orig_vma, start, end, adjust_next); > > + if (mas_preallocate(&mas, vma, GFP_KERNEL)) { > + if (exporter && exporter->anon_vma) > + unlink_anon_vmas(importer); > + return -ENOMEM; > + } > + > if (file) { > mapping = file->f_mapping; > root = &mapping->i_mmap; Running a syscall fuzzer for a while could still trigger some memory leak reports. unreferenced object 0xffff4021439c6100 (size 256): comm "trinity-c32", pid 1329067, jiffies 4301918356 (age 231692.944s) hex dump (first 32 bytes): 00 61 9c 43 21 40 ff ff 1c b1 65 1d 02 40 ff ff .a.C!@....e..@.. ff 2f 42 97 ff ff 00 00 ff 2f 43 97 ff ff 00 00 ./B....../C..... backtrace: [] slab_post_alloc_hook+0x98/0xf0 [] kmem_cache_alloc_bulk+0x26c/0x4ac [] mas_alloc_nodes+0x1e8/0x500 [] mas_preallocate+0xc8/0x210 [] __vma_adjust+0x27c/0x1290 __vma_adjust at mm/mmap.c:762 [] vma_merge+0x358/0x650 [] mprotect_fixup+0x160/0x530 [] do_mprotect_pkey.constprop.0+0x354/0x710 [] __arm64_sys_mprotect+0x78/0x130 [] invoke_syscall+0x74/0x260 [] el0_svc_common.constprop.0+0x1a8/0x260 [] do_el0_svc+0xac/0xe0 [] el0_svc+0x84/0x1c0 [] el0t_64_sync_handler+0xbc/0x140 [] el0t_64_sync+0x18c/0x190