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 473BEECAAD4 for ; Wed, 31 Aug 2022 07:37:46 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C26A56B0071; Wed, 31 Aug 2022 03:37:45 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BAE498D0002; Wed, 31 Aug 2022 03:37:45 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A50488D0001; Wed, 31 Aug 2022 03:37:45 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 8F2126B0071 for ; Wed, 31 Aug 2022 03:37:45 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 97C2D1A0D7B for ; Wed, 31 Aug 2022 07:37:44 +0000 (UTC) X-FDA: 79859083248.29.C2CC0CC Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf17.hostedemail.com (Postfix) with ESMTP id 1601B4002A for ; Wed, 31 Aug 2022 07:37:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1661931463; 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=JNkeOCkQxWe6Mi3JG04UFWk1/sXQ/UARfKjWroHg7QzEbB8ugH55Tfua4aNNXXvstI/JXd FQ+3EhJRF2YtchDxRKlsNbu4Pv2GO9NlYuvee2NOmS89dDWlELHkL+sZyAs/bBHijrJMQx ZD7cPDPMws9Na7LHJ1oFJweHaWKOrnA= 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 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1661931464; a=rsa-sha256; cv=none; b=ZhZqbShu/Za53omGiEiv1drUsT++jNm/gXEma0hcqdbkUal73RYlMns2x1v7/O74lsBqVx 0xpyNOEo5EWoqnYK0/7e+VBKaWDcsURq4nJp+NUbvss/bqIQpdem7ppBIaOEGyW+IHbfsx qGfDK6pNq5ALLXNB+iXW1MZE+AkdMRQ= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=JNkeOCkQ; spf=pass (imf17.hostedemail.com: domain of bhe@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=bhe@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1661931464; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=cPfv20m8zbbkOILlJ7mqdR3+5PwtptpQm0e1PHBqTYA=; b=SYWO0lbxku8/Ap2yuca3HFQmNOZBBFeTDuBWI03TLUbFNtJ+dm2k4xqFwYSYmiNUl2WaWN 17fbbYsifk7eL8oUISbkG4AANRk4NB0tfXA2uB0fSML3a5VIi5mtqDCx+TjoeXgX1ukSnt YRixioR0xy8oZfcfFos3bGpCluQGy2E= X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 1601B4002A X-Rspam-User: Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=JNkeOCkQ; spf=pass (imf17.hostedemail.com: domain of bhe@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=bhe@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-Stat-Signature: zjiwo65fwpdqx5ydqubr6688rreau149 X-HE-Tag: 1661931463-150714 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 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 >