Message ID | 20211005012959.1110504-9-Liam.Howlett@oracle.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <SRS0=pyM+=OZ=kvack.org=owner-linux-mm@kernel.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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EA735C433EF for <linux-mm@archiver.kernel.org>; Tue, 5 Oct 2021 01:31:21 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 964C46121F for <linux-mm@archiver.kernel.org>; Tue, 5 Oct 2021 01:31:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 964C46121F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oracle.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 3884994000E; Mon, 4 Oct 2021 21:31:21 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3349A94000A; Mon, 4 Oct 2021 21:31:21 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1392794000E; Mon, 4 Oct 2021 21:31:21 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0025.hostedemail.com [216.40.44.25]) by kanga.kvack.org (Postfix) with ESMTP id 02DAB94000A for <linux-mm@kvack.org>; Mon, 4 Oct 2021 21:31:21 -0400 (EDT) Received: from smtpin21.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id BA59D30163 for <linux-mm@kvack.org>; Tue, 5 Oct 2021 01:31:20 +0000 (UTC) X-FDA: 78660655920.21.DA60082 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by imf04.hostedemail.com (Postfix) with ESMTP id 3F74C50009CE for <linux-mm@kvack.org>; Tue, 5 Oct 2021 01:31:20 +0000 (UTC) Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 1951Awbk019258; Tue, 5 Oct 2021 01:31:13 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-transfer-encoding : mime-version; s=corp-2021-07-09; bh=YwoDWzBTBDcUgz8r0Ko8DsxvF4zH+ee/T3rLbx85xzE=; b=PkxPBxKkpCqX56g4emdaLDpt86DW331Tf1C2+kJpDVfVW/qVnrXpSTeSC3ShkdqHUoYy 45+3KMHeChP97QOayDuzG3zWaPVaDvJ37b9lJUWxOye1ZPOaWprP6UY840x7zCD2mMbf a+Xxchq18j4JgBoehk27M3fOfO8f1BoQ93u6nEqSCK7FhaHXCwQ3+FFaDmjLDtpjmqQ9 xSBuD17vghDPlSKm3ZfHAdPbWI9T7S57BcmHsFZnT13xH8vIbdDYJm1P5i9rRNzQH804 nyLf2137O3y5CyOg3git0ywTp3iThl4defJ0Lo1PzVtjUZY7k7Yvt5Xd/miyAtUN8D4x yg== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by mx0b-00069f02.pphosted.com with ESMTP id 3bg3p5c97y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 05 Oct 2021 01:31:10 +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 1951Ueb9141761; Tue, 5 Oct 2021 01:30:43 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2177.outbound.protection.outlook.com [104.47.58.177]) by userp3020.oracle.com with ESMTP id 3bf16s9dua-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 05 Oct 2021 01:30:43 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bl0FvPx4KbqP4ouEdwJAiPmmczFvrIveRWAtqXunr1YDbB7EFNvAY3CRdsfo0YxmRwo9z9jNhUrSMhKCH7oMeuqdz9pazxl4W8y/PwSuNt7nRL64/3/WQCe7YuYI8FOIOg/kh8fZiQ/pLeUK0l3iS6k8OejTsWqWs9Ajbn5YnDQjl1FF+r+mFeK9Ce3/ixsGc/hHdKJ/2YxIzrjAWDCf7f6dMMLQIlezhzLVPeTj7LC/52+67tI1GwE2p8WAMp38bNaju6R3tssL4fANZnBFnujv1HKgaAful3rYMKow9t+6AhodWDhgQOsmblf3aYbPxYDOoEte4PIl1+yDYFN9CQ== 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=YwoDWzBTBDcUgz8r0Ko8DsxvF4zH+ee/T3rLbx85xzE=; b=BgBKeqJKWBHnyIHPQ6BJM7fLPealcuVoJmNdkXdocf71jIAYJAJ447RmKc3hlq4QEvNEq9gX70diip/0keO0Onieb5zHzx58gRLgErbQ+0i5JfTHuDeQ/HMhBO27QnTe7ZXfq0ijXluNiZ/fUft270GOY/hZlpe4cNecDjZZSTz8jNOXpG6eS7s1e9Vn2oLlwEHPR7ypp+o3emdY5K4cEI7aD2Mm+p6EY+drqC8vh8UFpAlCdT2n6TBM2i+BxQAgiMGD6KQngql1ahqQauhf2yRPfvZP7YEpNsFjOCrH3BdedHqBgNbSe5IudFTEYaqQQP/mDgUzD036uROTs5D9Ug== 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=YwoDWzBTBDcUgz8r0Ko8DsxvF4zH+ee/T3rLbx85xzE=; b=IS1XAwy9NT43WnRMtMzxieUpQVW1ZXKnhwKnNdnyvZEQBWBIJCQJdUS3Y5JyuhPVqxEKdedEBYJNp/e8RmjR/mHARCBPlkG7eLpuY4kDQUUK0xoAtSszoJwWBJKhNCtb+Q8Lot4Qadgz/r89umhswbRXmN+jB665XJuNFcQp6E8= Received: from BL0PR10MB3011.namprd10.prod.outlook.com (2603:10b6:208:7e::29) by BLAPR10MB5218.namprd10.prod.outlook.com (2603:10b6:208:306::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4566.15; Tue, 5 Oct 2021 01:30:34 +0000 Received: from BL0PR10MB3011.namprd10.prod.outlook.com ([fe80::6d61:54c2:40f0:93a]) by BL0PR10MB3011.namprd10.prod.outlook.com ([fe80::6d61:54c2:40f0:93a%5]) with mapi id 15.20.4566.017; Tue, 5 Oct 2021 01:30:34 +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>, David Hildenbrand <david@redhat.com>, Douglas Gilbert <dgilbert@interlog.com> CC: Song Liu <songliubraving@fb.com>, Davidlohr Bueso <dave@stgolabs.net>, "Paul E . McKenney" <paulmck@kernel.org>, Matthew Wilcox <willy@infradead.org>, David Rientjes <rientjes@google.com>, Axel Rasmussen <axelrasmussen@google.com>, Suren Baghdasaryan <surenb@google.com>, Vlastimil Babka <vbabka@suse.cz>, Rik van Riel <riel@surriel.com>, Peter Zijlstra <peterz@infradead.org> Subject: [PATCH v3 08/66] mm/mmap: Use the maple tree for find_vma_prev() instead of the rbtree Thread-Topic: [PATCH v3 08/66] mm/mmap: Use the maple tree for find_vma_prev() instead of the rbtree Thread-Index: AQHXuYiXDosBZ3Y2uk6Sc+lidyUqVQ== Date: Tue, 5 Oct 2021 01:30:34 +0000 Message-ID: <20211005012959.1110504-9-Liam.Howlett@oracle.com> References: <20211005012959.1110504-1-Liam.Howlett@oracle.com> In-Reply-To: <20211005012959.1110504-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.30.2 x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 49c784d7-faba-461d-f297-08d9879fba82 x-ms-traffictypediagnostic: BLAPR10MB5218: x-microsoft-antispam-prvs: <BLAPR10MB52186C2E819C57BE02AE6188FDAF9@BLAPR10MB5218.namprd10.prod.outlook.com> x-ms-oob-tlc-oobclassifiers: OLM:9508; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: k0Ocud3zIv7Ojnx82qBj17cPNBvUJdj3FoUS05dkgZfsIwIBAmmm0xqus2aSHeLsVHdJ4NJIl8ECtkN2l6kSCBaypA5ylhkp3yDh4T0OASCz3GrlGHbTXwDFyicmj7c00Ccud1WYjq+nHyI/e58YFkUtDV4rF5pfL6NNa1zagg02U5/M8zOj5CMErDeRlkzl7D+oXblPhWSz+f+GGFg7Onf5dKbbodoZKIQ7Dqw+VwwcdgodRGgsGzLyDq75uzsh69b8L0sOuZ2q65lvATZDwRom7ir9M35UOfgvHeleyjNKRWnEH8wHvs5fDmsSj9A5rExcMpUoB/38rc/6PZODJSTkDV6SU7g8Cr264jIdmGTY2XgJUMSdn1m0gw9WusUXYqCRqihDnS/zL3JGpb0oPl3XlT3wzu8Ua/JlxROps4FV538qEXV0RSyzA1gaR4sFBsyXfXgLPqzLv1Mu7DyJPQ/Mac8nfkLIbmMgf6dQ07tSNhxFVngQuTrBbjckmXPWPvc7y0H+fPqvTpE5HrWQ8LD8jERxsXJCpGbeT+vCkgGoz7Pro6AD7U67pAYn5QC//5WrDVnD6T7Cnu/YrCWZpe7YiSklodn3mpx4Qjg264pMvgV7TgqIpqJeGKEvwkLDCuO5a12+62K/yWKub6PdeqkSgIrgOG6sMqk2xxY8DbIgA3xsFq/ghLN1XKZsNtHxOudqFbCS3BVOMne+4U2H3A== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BL0PR10MB3011.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(366004)(26005)(5660300002)(6486002)(186003)(6506007)(86362001)(6512007)(1076003)(36756003)(38100700002)(508600001)(8936002)(71200400001)(8676002)(122000001)(316002)(110136005)(76116006)(91956017)(2616005)(44832011)(7416002)(38070700005)(54906003)(4326008)(66556008)(2906002)(64756008)(83380400001)(66476007)(66946007)(66446008);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?BY8t+N0RFNvgA/KM3BeP4lk?= =?iso-8859-1?q?rVZHJxIgAdIAIGKw1VgUWJ8OhkV3F0u4OApfiA8t5ddiIP76UPRPhALKcyy2?= =?iso-8859-1?q?XUkX44V0f8yq7AKsG9u59FqzM6OZBDpF5E+nhaRu7OosNq0H+m9k9nNP87qe?= =?iso-8859-1?q?Da/KuYEKICRX5CkG/NoblsQN1Txwl8ZmR9/OaXorSPnjnDC2nehftAdJJhEm?= =?iso-8859-1?q?PvcV48nGfD0QN32deYPcEr/HJuOvS9szuIyr+LrIjXZ3ybpOefDlIKRNsQ8q?= =?iso-8859-1?q?ve5RTm3MNZF6VCVLcVexWafxuUf4JBfvAIHfvkAyOFghBb0mYwV39Cu8Ytb/?= =?iso-8859-1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js9tcp/mV5/LSOJsCUmvxeqs/beqyBeu0UemrY1U7?= =?iso-8859-1?q?GviRzTW5kb05vvy3r4uS5rPENqNiUR1gHAWrqje8GiB/v3+ivlejleemcVGm?= =?iso-8859-1?q?rvsxQJOGPGzYQccxOYouDRH/jBgAyhKiA+X5aiZOp2P4DZms3UCcRPkyhFAy?= =?iso-8859-1?q?y?= x-ms-exchange-transport-forked: True 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: BL0PR10MB3011.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 49c784d7-faba-461d-f297-08d9879fba82 X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Oct 2021 01:30:34.2373 (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: Q8Rf0x3KN4XkHtCp5vUXcZCSyf/AWxljTC3U4R8uexYke0zCKseI2b96iP6ovb81NXdRf6ZG25p+hsyK0bEf6Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLAPR10MB5218 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10127 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 adultscore=0 phishscore=0 malwarescore=0 bulkscore=0 mlxlogscore=999 mlxscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2109230001 definitions=main-2110050007 X-Proofpoint-ORIG-GUID: IuA24hc22glnKFy0KdJxoxepvdDpocya X-Proofpoint-GUID: IuA24hc22glnKFy0KdJxoxepvdDpocya X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 3F74C50009CE X-Stat-Signature: 7u5jiuh6jjq8wyeex6e7ouedapkkr37w Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2021-07-09 header.b=PkxPBxKk; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=IS1XAwy9; dmarc=pass (policy=none) header.from=oracle.com; spf=none (imf04.hostedemail.com: domain of liam.howlett@oracle.com has no SPF policy when checking 205.220.165.32) smtp.mailfrom=liam.howlett@oracle.com X-HE-Tag: 1633397480-652268 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/mm/mmap.c b/mm/mmap.c index fde3497a3c85..f6856bf65f2b 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -2484,23 +2484,30 @@ struct vm_area_struct *find_vma(struct mm_struct *mm, unsigned long addr) } EXPORT_SYMBOL(find_vma); -/* - * Same as find_vma, but also return a pointer to the previous VMA in *pprev. +/** + * find_vma_prev() - Find the VMA for a given address, or the next vma and + * set %pprev to the previous VMA, if any. + * @mm: The mm_struct to check + * @addr: The address + * @pprev: The pointer to set to the previous VMA + * + * Returns: The VMA associated with @addr, or the next vma. + * May return %NULL in the case of no vma at addr or above. */ struct vm_area_struct * find_vma_prev(struct mm_struct *mm, unsigned long addr, - struct vm_area_struct **pprev) + struct vm_area_struct **pprev) { struct vm_area_struct *vma; + MA_STATE(mas, &mm->mm_mt, addr, addr); - vma = find_vma(mm, addr); - if (vma) { - *pprev = vma->vm_prev; - } else { - struct rb_node *rb_node = rb_last(&mm->mm_rb); + rcu_read_lock(); + vma = mas_find(&mas, ULONG_MAX); + if (!vma) + mas_reset(&mas); - *pprev = rb_node ? rb_entry(rb_node, struct vm_area_struct, vm_rb) : NULL; - } + *pprev = mas_prev(&mas, 0); + rcu_read_unlock(); return vma; }