Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp196941rwe; Wed, 31 Aug 2022 00:45:45 -0700 (PDT) X-Google-Smtp-Source: AA6agR79nmYX4RPS/1mdYtdNbMIXCDyczYv3q7vc/bv5ZENXCwY3Z5mzzs60ovC3TD2B62YhXi+K X-Received: by 2002:a63:2cd0:0:b0:41c:5f9b:893c with SMTP id s199-20020a632cd0000000b0041c5f9b893cmr21028495pgs.173.1661931945588; Wed, 31 Aug 2022 00:45:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661931945; cv=none; d=google.com; s=arc-20160816; b=We6o8AgV8P+9a90SiBkmwK286IjGp0i7+J9X9IQzLfwj8+9AdH/WUYooYHCEY+PtV9 +T9XCn0pabewQVIwKHqZIUv72Po6TdhcHayAkFdxkxYXYrUgY3LwuBHowix+aY2scvRq 8xPUwaGJMVHPykknUN4Bg8eVjRprOb8GbS0mIJ56puYXUewjZj95yFBoT5NE/T22mJRZ npF9Su+E2zIoDRMgchhMLP+GS2v8yOYVvAN+cpSxGi74UH0Wibq727DDY2GISRvtKr2D jVUisNYVYHvugPPLdYKuA423uGXNJHAW2MHXCp4JRGZN1+PaPRDj7wMygwJtEiJCrPp2 ktGw== 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=cPfv20m8zbbkOILlJ7mqdR3+5PwtptpQm0e1PHBqTYA=; b=rsvo/xlqvxT2q1Xz9sdp7s8XLBjcB3akQn09Nsj6oD61J1dStKLtZUuFjhSYQdDegi z1lszZWAppu3IB27I38SxfkE+/fFODteWWtlmeKdSsGLakfWocV4n9rS9UDHcnMI8Wkf WRZmk2pDvwiRymX96siysW4u2dCi1yKb5pE320Gh1DC4wtItKPM292WhOJ2oNFr8X13Z RLpuCNFj50h7+7wGr5G+9yhnawCOuiTUPfd7D1udgL9l0XT55kU2M5YDHSRwUky1jEwZ 5CakjW/xti6Ng+Qpdf56NGvKVwcgy2KkW+rfaXYF0JsCJFJs8vRjR83+3QJuDdnAG/P0 tl3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Z3pdyanO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u15-20020a170902e80f00b00172ccb0862fsi8188263plg.88.2022.08.31.00.45.32; Wed, 31 Aug 2022 00:45:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Z3pdyanO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229867AbiHaHhn (ORCPT + 99 others); Wed, 31 Aug 2022 03:37:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38448 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229457AbiHaHhl (ORCPT ); Wed, 31 Aug 2022 03:37:41 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8557CAFAF6 for ; Wed, 31 Aug 2022 00:37:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1661931459; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=cPfv20m8zbbkOILlJ7mqdR3+5PwtptpQm0e1PHBqTYA=; b=Z3pdyanOhh5d4gE+Jfu3SknmcbdvfLa0c4L8VJLtMNqxN622zBBv0tZ+KIHN/+s1gln3LG TObUeKIT3A+WGUc1Be94Xh+Fj6OuGq7v3ppo+3DPVeBrI/oTKMGzNgIoxHr0/RRhsr9x7p BFYlE6xzcd0Mq91j+T8wN8+Xusb0mhM= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-675-zPm5yYWbOaWdrOkP8bXzoA-1; Wed, 31 Aug 2022 03:37:37 -0400 X-MC-Unique: zPm5yYWbOaWdrOkP8bXzoA-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 533741C07821; Wed, 31 Aug 2022 07:37:37 +0000 (UTC) Received: from localhost (ovpn-13-50.pek2.redhat.com [10.72.13.50]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7C3FC2166B2A; Wed, 31 Aug 2022 07:37:36 +0000 (UTC) Date: Wed, 31 Aug 2022 15:37:32 +0800 From: Baoquan He To: Song Liu Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, songliubraving@fb.com, Uladzislau Rezki , Andrew Morton Subject: Re: [PATCH] mm/vmalloc: Extend find_vmap_lowest_match_check with extra arguments Message-ID: References: <20220831052734.3423079-1-song@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220831052734.3423079-1-song@kernel.org> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham 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 08/30/22 at 10:27pm, Song Liu wrote: > find_vmap_lowest_match() is now able to handle different roots. Make > similar changes to find_vmap_lowest_match_check() and > find_vmap_lowest_linear_match() to handle different trees. Good catch. Guess usually nobody eables DEBUG_AUGMENT_LOWEST_MATCH_CHECK to trigger compilation of the code. Reviewed-by: Baoquan He > > Fixes: f9863be49312 ("mm/vmalloc: extend __alloc_vmap_area() with extra arguments") > Cc: Uladzislau Rezki (Sony) > Cc: Baoquan He > Cc: Andrew Morton > Signed-off-by: Song Liu > --- > mm/vmalloc.c | 13 +++++++------ > 1 file changed, 7 insertions(+), 6 deletions(-) > > diff --git a/mm/vmalloc.c b/mm/vmalloc.c > index dd6cdb201195..088b421601c4 100644 > --- a/mm/vmalloc.c > +++ b/mm/vmalloc.c > @@ -1300,12 +1300,12 @@ find_vmap_lowest_match(struct rb_root *root, unsigned long size, > #include > > static struct vmap_area * > -find_vmap_lowest_linear_match(unsigned long size, > +find_vmap_lowest_linear_match(struct list_head *head, unsigned long size, > unsigned long align, unsigned long vstart) > { > struct vmap_area *va; > > - list_for_each_entry(va, &free_vmap_area_list, list) { > + list_for_each_entry(va, head, list) { > if (!is_within_this_va(va, size, align, vstart)) > continue; > > @@ -1316,7 +1316,8 @@ find_vmap_lowest_linear_match(unsigned long size, > } > > static void > -find_vmap_lowest_match_check(unsigned long size, unsigned long align) > +find_vmap_lowest_match_check(struct rb_root *root, struct list_head *head, > + unsigned long size, unsigned long align) > { > struct vmap_area *va_1, *va_2; > unsigned long vstart; > @@ -1325,8 +1326,8 @@ find_vmap_lowest_match_check(unsigned long size, unsigned long align) > get_random_bytes(&rnd, sizeof(rnd)); > vstart = VMALLOC_START + rnd; > > - va_1 = find_vmap_lowest_match(size, align, vstart, false); > - va_2 = find_vmap_lowest_linear_match(size, align, vstart); > + va_1 = find_vmap_lowest_match(root, size, align, vstart, false); > + va_2 = find_vmap_lowest_linear_match(head, size, align, vstart); > > if (va_1 != va_2) > pr_emerg("not lowest: t: 0x%p, l: 0x%p, v: 0x%lx\n", > @@ -1513,7 +1514,7 @@ __alloc_vmap_area(struct rb_root *root, struct list_head *head, > return vend; > > #if DEBUG_AUGMENT_LOWEST_MATCH_CHECK > - find_vmap_lowest_match_check(size, align); > + find_vmap_lowest_match_check(root, head, size, align); > #endif > > return nva_start_addr; > -- > 2.30.2 >