Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp383992iof; Mon, 6 Jun 2022 05:28:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyUsi8IxgWC/F8ta6x/PzSu8gweYZcVX1gsuH2XPLwDDUIhDAUf68xwpnFNQEZSAKfL+0L8 X-Received: by 2002:a17:903:2411:b0:167:396:e31 with SMTP id e17-20020a170903241100b0016703960e31mr18926450plo.155.1654518517229; Mon, 06 Jun 2022 05:28:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654518517; cv=none; d=google.com; s=arc-20160816; b=XWoIz1zSAiK+Yi/gvIMm1cD5fgEBv2Ks1ycY4sSd1zWshIhdBLm1JFkmrTdlO/5esc 2XwZnXBH1UVOJiCT+9sH/tq3LKL5s+6FqbOPIY36cyvn3leIiN0a5coEn6OsRQsyyL/x q9nRU0sMMOfI4vok6+NR+2UFpClGw/k5OFqWF4Ysjw2OZ21QTtzk9UqOYGgF6cBqli5V EkDeMy6Zh5DGbRFM6mVzNCK47B/Jd3du417KDQiYWuV9eTUpRrJyYyJLjAjqiu0ofzM5 Asc1U2I6PFPTd9QbD0JiTObFrWl/VpC7wx+fPmzvDuU56dE6r+IfAZE4R75l6hb+ZZVN sSwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=1r4i7S693eNGdvCLoo3S36nunc2SGIhjZFlXs94KVRg=; b=l+kAX8nm83M8LG0TulIvomm5ZU3l/ItfJWMt7xYoyM6PdFQmnelBnXqQAmMbozmxdD 7Otdop7nx6HPfPublHy065ZsMSO9v8vsFiTFU/9TlzsU3lK2G4xfmYzAMfLt9P+U4mqm DWZL9oIDeOXkBoJMR6jcfvZnWEuuiHW6qshziPAqtdikycDUTB+jcNbKmpQtk9eOxUh6 n7auH4D8It8bbylvJFG/0xZWn/ivgeRBfYpUbtmbhXC7mUI0l1I1epZsxZbY0T3F4E/N qTV+AdvG/9UjShipr4KBfGa0gbLdbjjr3sgskrrTq9S08NSpMRJuINol8EsxGteA0bpc y62Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=sdAwZoKD; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id q188-20020a632ac5000000b003fd63c3d9efsi9623981pgq.453.2022.06.06.05.28.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jun 2022 05:28:37 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=sdAwZoKD; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id C4CFA2A5501; Mon, 6 Jun 2022 05:26:22 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236899AbiFFM0Q (ORCPT + 99 others); Mon, 6 Jun 2022 08:26:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55934 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236893AbiFFM0O (ORCPT ); Mon, 6 Jun 2022 08:26:14 -0400 Received: from alexa-out-sd-01.qualcomm.com (alexa-out-sd-01.qualcomm.com [199.106.114.38]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 162492A3BBD for ; Mon, 6 Jun 2022 05:26:14 -0700 (PDT) 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-01.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-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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