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 80C62C43334 for ; Thu, 23 Jun 2022 17:25:59 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 036058E016B; Thu, 23 Jun 2022 13:25:59 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id F26988E0144; Thu, 23 Jun 2022 13:25:58 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DEE858E016B; Thu, 23 Jun 2022 13:25:58 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id CF7048E0144 for ; Thu, 23 Jun 2022 13:25:58 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 9CFEF206C8 for ; Thu, 23 Jun 2022 17:25:58 +0000 (UTC) X-FDA: 79610178396.26.148CB8C Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf28.hostedemail.com (Postfix) with ESMTP id 17BADC00B2 for ; Thu, 23 Jun 2022 17:25:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1656005157; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4H0hc8Du3nY/oCseQOeBBjY2ZACt1jajcUPDM0qtvz4=; b=RVuljAJM5S2bteL3KffuGOqRWiCdYFeYnrTHwhwWVYtiVlfk7tEYejHTjaXXFleY7XIEZL t4XElqy00k7fbxoc8OaNMIP8eZQpJ/UPt7mEOv3TLP3IENjkGmxal1aTslHyyaLgP7fyDZ zVPwrcvVCsnKZdKxGsLPoT0BxCPmW+w= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-166-Rtmby6v0Nkm0hKaPixSjYw-1; Thu, 23 Jun 2022 13:25:56 -0400 X-MC-Unique: Rtmby6v0Nkm0hKaPixSjYw-1 Received: by mail-wm1-f72.google.com with SMTP id l17-20020a05600c4f1100b0039c860db521so90968wmq.5 for ; Thu, 23 Jun 2022 10:25:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent :content-language:to:references:from:organization:subject :in-reply-to:content-transfer-encoding; bh=4H0hc8Du3nY/oCseQOeBBjY2ZACt1jajcUPDM0qtvz4=; b=Za9Dhk4/e6tenQpiqCbAv6Iv1l3Bu2WKNEHd4Ebs1ek2F2Q8GY1g0oMyJ0eDTEB3c/ HbcpdRP5fj/Y6pThsu0E02LJuoyDplP/aCXC8utFg3DpIpJyjlS9nDyvVMUG1x9VcIyA KFRZl6Ax2R4RA3gfbyGU5KPx4JslI34IOnB4pur3JDpHjQ5TemDu03MR+5cDEZvvs+mx 3pnBAMXZ81ScDfcm91TzDo0Y1rG1PfJRbo9VUOQu+Wk2SBTqmIT7X3nyvjToEPiPlzm+ r5Km2pTuo+kQo/hY75GjOnYAlPBKWJj9+0Ym7E6UCF1vnmTQXeW8vWchwFwc7GGdXnTW u96A== X-Gm-Message-State: AJIora9uQqIJZk7vFxDdZ0UXWcQuS0/OW5EfzKpMy+6VeDTLpJOCJzRy aIBMpgViEbAQQ9xq2LKTBgfRRaDGWWKjjnGHJoV721KBRqT8hM9P62fmygwwpQcSdyEEgF6bYeU gmJc+86bOTyU= X-Received: by 2002:a05:600c:3503:b0:39c:65e0:c070 with SMTP id h3-20020a05600c350300b0039c65e0c070mr5373283wmq.161.1656005155009; Thu, 23 Jun 2022 10:25:55 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vJyq9ZzEeWdCIMTKXFNIDyGCOfxTXaE0YEorcmZChZlK3RamVYTnhSFvza4mKsapK/OGnOUw== X-Received: by 2002:a05:600c:3503:b0:39c:65e0:c070 with SMTP id h3-20020a05600c350300b0039c65e0c070mr5373264wmq.161.1656005154769; Thu, 23 Jun 2022 10:25:54 -0700 (PDT) Received: from ?IPV6:2003:cb:c704:b100:7694:f34e:d0dd:95e7? (p200300cbc704b1007694f34ed0dd95e7.dip0.t-ipconnect.de. [2003:cb:c704:b100:7694:f34e:d0dd:95e7]) by smtp.gmail.com with ESMTPSA id r13-20020a5d4e4d000000b0021b96cdf68fsm8917991wrt.97.2022.06.23.10.25.53 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 23 Jun 2022 10:25:54 -0700 (PDT) Message-ID: <5972b785-a98a-ca3d-8c21-8156dd981749@redhat.com> Date: Thu, 23 Jun 2022 19:25:53 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 To: Liam Howlett , "maple-tree@lists.infradead.org" , "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" , Andrew Morton , "damon @ lists . linux . dev" , SeongJae Park References: <20220621204632.3370049-1-Liam.Howlett@oracle.com> <20220621204632.3370049-14-Liam.Howlett@oracle.com> From: David Hildenbrand Organization: Red Hat Subject: Re: [PATCH v10 13/69] mm/mmap: use maple tree for unmapped_area{_topdown} In-Reply-To: <20220621204632.3370049-14-Liam.Howlett@oracle.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=RVuljAJM; dmarc=pass (policy=none) header.from=redhat.com; spf=none (imf28.hostedemail.com: domain of david@redhat.com has no SPF policy when checking 170.10.133.124) smtp.mailfrom=david@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1656005158; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to: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=4H0hc8Du3nY/oCseQOeBBjY2ZACt1jajcUPDM0qtvz4=; b=247De1rihyZFQ9vFpzWZWA3jYSN66mDBM4OFiFTkyRdxY1/ckBVuNE1Gdd3ypc5UuF18r4 pSZlRBdQzaJdyTIYPF0jSIM3Kmo+1KrA4csQYkP4D+HL1Ah/KcVq/TH0kZQCT/5Selwed8 TEqbojfHFAzX0hwS3e3U/yVb6nh9Nrw= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1656005158; a=rsa-sha256; cv=none; b=OhUirlA2TTtLxNSrjzHjE+Im8n1gZ2nmE+qlOY7IZ7iMjErs2uJyAHtPPGd44j8i4ZZRxT ldM3rgL+KiODiIUEeyiTxCU344KqVljEY9P9KghZh2uL110ErpBpXDkPrczumd3+fu2b93 zPXEZOFYEjHpETSGHtanYh6eY1hEXJE= X-Stat-Signature: foeobjy4k5c9b85rfz48p3ix4f5jmyoz X-Rspamd-Queue-Id: 17BADC00B2 X-Rspam-User: Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=RVuljAJM; dmarc=pass (policy=none) header.from=redhat.com; spf=none (imf28.hostedemail.com: domain of david@redhat.com has no SPF policy when checking 170.10.133.124) smtp.mailfrom=david@redhat.com X-Rspamd-Server: rspam12 X-HE-Tag: 1656005157-284406 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 21.06.22 22:46, Liam Howlett wrote: > From: "Liam R. Howlett" > > The maple tree code was added to find the unmapped area in a previous > commit and was checked against what the rbtree returned, but the actual > result was never used. Start using the maple tree implementation and > remove the rbtree code. > > Add kernel documentation comment for these functions. > > Link: https://lkml.kernel.org/r/20220504010716.661115-15-Liam.Howlett@oracle.com > Signed-off-by: Liam R. Howlett > Cc: Catalin Marinas > Cc: David Howells > Cc: "Matthew Wilcox (Oracle)" > Cc: SeongJae Park > Cc: Vlastimil Babka > Cc: Will Deacon > Cc: Davidlohr Bueso > Signed-off-by: Andrew Morton > --- > mm/mmap.c | 253 +++++++----------------------------------------------- > 1 file changed, 32 insertions(+), 221 deletions(-) > > diff --git a/mm/mmap.c b/mm/mmap.c > index 08845a0317bf..b91d22329418 100644 > --- a/mm/mmap.c > +++ b/mm/mmap.c > @@ -2053,250 +2053,61 @@ unsigned long mmap_region(struct file *file, unsigned long addr, > return error; > } > > +/* unmapped_area() Find an area between the low_limit and the high_limit with /** * unmapped_area() - ... > + * the correct alignment and offset, all from @info. Note: current->mm is used > + * for the search. > + * > + * @info: The unmapped area information including the range (low_limit - > + * hight_limit), the alignment offset and mask. > + * > + * Return: A memory address or -ENOMEM. > + */ > static unsigned long unmapped_area(struct vm_unmapped_area_info *info) > { ... > > +/* unmapped_area_topdown() Find an area between the low_limit and the \Dito > + * high_limit with * the correct alignment and offset at the highest available > + * address, all from * @info. Note: current->mm is used for the search. I'm confused about the "*" in the text, but maybe I'm just tired :) > + * > + * @info: The unmapped area information including the range (low_limit - > + * hight_limit), the alignment offset and mask. > + * > + * Return: A memory address or -ENOMEM. > + */ > static unsigned long unmapped_area_topdown(struct vm_unmapped_area_info *info) > { [...] > -found: > - /* We found a suitable gap. Clip it with the original high_limit. */ > - if (gap_end > info->high_limit) > - gap_end = info->high_limit; > - > -found_highest: > - /* Compute highest gap address at the desired alignment */ > - gap_end -= info->length; > - gap_end -= (gap_end - info->align_offset) & info->align_mask; > - > - VM_BUG_ON(gap_end < info->low_limit); > - VM_BUG_ON(gap_end < gap_start); Can we leave some of these in, please? (same applies to other function) I keep getting confused by align_offset. vs align_mask. I *think* this is correct, but some checks that we stay in limits and actually have proper alignment would be reasonable. -- Thanks, David / dhildenb