From patchwork Tue Jun 7 09:34:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Uladzislau Rezki X-Patchwork-Id: 12871637 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 98397C43334 for ; Tue, 7 Jun 2022 09:35:08 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A994A8D000A; Tue, 7 Jun 2022 05:35:05 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A25578D0001; Tue, 7 Jun 2022 05:35:05 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 89B088D000A; Tue, 7 Jun 2022 05:35:05 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 79D148D0001 for ; Tue, 7 Jun 2022 05:35:05 -0400 (EDT) Received: from smtpin31.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 58DE720C3C for ; Tue, 7 Jun 2022 09:35:05 +0000 (UTC) X-FDA: 79550930970.31.19095AD Received: from mail-lf1-f54.google.com (mail-lf1-f54.google.com [209.85.167.54]) by imf15.hostedemail.com (Postfix) with ESMTP id 9DF0AA0047 for ; Tue, 7 Jun 2022 09:34:38 +0000 (UTC) Received: by mail-lf1-f54.google.com with SMTP id t25so27362518lfg.7 for ; Tue, 07 Jun 2022 02:35:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=1imnAi5xz7HqCapEhh8k4KqTLfM1rDshD69OorDTV3Q=; b=FUe9hoC2gjsIGPJVEps761z94HHtbSP1LOQ6MOwoWAKATBaoen37ggvBdmhCO/1Dum bbL9wrYkQmZn5AFVSvqe7rIa4w9PVKkiXXig9eo+xADy33IXOFhyk8i7zMef75DgfAtF jWLLcPerKOjLVHT/t3gqLFTldCmrOvYRPaBzZMiNcUGk5R+FRdJy1YwX/KhRUom+U2/A DsIG8C52yvsQbR5nK0UpenU11Tf/PharFyrCbvu2QYv3HpGWk6uE6m5Ofoq1vk+hAz1a TsH4UPB9OMAyuBrQXofmV+miPQHfnsjtpErZBJ/kZrFD7q3l26g8RK0tKkPYDTKpM0px U2XQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=1imnAi5xz7HqCapEhh8k4KqTLfM1rDshD69OorDTV3Q=; b=pnAHo/r/GveljN3LW4CRNTsSK7xlEG2j2di96yFZvfMgK5UBvURZaKXqryzh+2d8RT /pbw9DVX09+coHZFlg1xqBbwNFkmMUExckFH+MSddyx1Ke8adl/4jmPiysa2tTxoI+TP MGIno7n9VccYPRRU87XLLIj+5ljcFAJF2OIktEQyAoOae5J/4WJezxccLSmEngFGgEZt /GVHCEdqfQPgNpVt87aj7Li3rX85j6LA279G19PZ8dpvudhGy9pmLnn6d1fTsvE7UBTB l9r45Ug/rpnbwmnXIx3y/m7mnSQzs/DG3zKh9sY0ovbXo+3WWZKJfEdQ0VnY5Ie661Ft d/JA== X-Gm-Message-State: AOAM531EeB6q1ANfBjvbEP3hd5UqBnbHSfh/aQ23whLIRQVy55riBUB3 zMRcMcLYSl6Zp5IO8MjAHno= X-Google-Smtp-Source: ABdhPJwUtUjYWUsi2A0Gz+SKLSqewTZ8rOUEGsOboyqIoXV8szQIuSCZZkSiPZcSm6rDEt2nEkryUQ== X-Received: by 2002:a05:6512:2351:b0:479:6c3b:5d4 with SMTP id p17-20020a056512235100b004796c3b05d4mr526524lfu.87.1654594503595; Tue, 07 Jun 2022 02:35:03 -0700 (PDT) Received: from pc638.lan ([155.137.26.201]) by smtp.gmail.com with ESMTPSA id r27-20020a2e575b000000b002554a4ebf5fsm2748043ljd.74.2022.06.07.02.35.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 02:35:03 -0700 (PDT) From: "Uladzislau Rezki (Sony)" To: Andrew Morton Cc: linux-mm@kvack.org, LKML , Christoph Hellwig , Matthew Wilcox , Nicholas Piggin , Uladzislau Rezki , Oleksiy Avramchenko Subject: [PATCH 4/5] mm/vmalloc: Extend __find_vmap_area() with one more argument Date: Tue, 7 Jun 2022 11:34:48 +0200 Message-Id: <20220607093449.3100-5-urezki@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220607093449.3100-1-urezki@gmail.com> References: <20220607093449.3100-1-urezki@gmail.com> MIME-Version: 1.0 X-Stat-Signature: j6up1tyis3jeftz75ujszgbncnbc6x8m Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=FUe9hoC2; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf15.hostedemail.com: domain of urezki@gmail.com designates 209.85.167.54 as permitted sender) smtp.mailfrom=urezki@gmail.com X-Rspam-User: X-Rspamd-Server: rspam11 X-Rspamd-Queue-Id: 9DF0AA0047 X-HE-Tag: 1654594478-122455 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: __find_vmap_area() finds a "vmap_area" based on passed address. It scan the specific "vmap_area_root" rb-tree. Extend the function with one extra argument, so any tree can be specified where the search has to be done. There is no functional change as a result of this patch. Signed-off-by: Uladzislau Rezki (Sony) Reviewed-by: Baoquan He --- mm/vmalloc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mm/vmalloc.c b/mm/vmalloc.c index 82771e555273..b60385101897 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -814,9 +814,9 @@ static struct vmap_area *find_vmap_area_exceed_addr(unsigned long addr) return va; } -static struct vmap_area *__find_vmap_area(unsigned long addr) +static struct vmap_area *__find_vmap_area(unsigned long addr, struct rb_root *root) { - struct rb_node *n = vmap_area_root.rb_node; + struct rb_node *n = root->rb_node; addr = (unsigned long)kasan_reset_tag((void *)addr); @@ -1840,7 +1840,7 @@ static struct vmap_area *find_vmap_area(unsigned long addr) struct vmap_area *va; spin_lock(&vmap_area_lock); - va = __find_vmap_area(addr); + va = __find_vmap_area(addr, &vmap_area_root); spin_unlock(&vmap_area_lock); return va; @@ -2582,7 +2582,7 @@ struct vm_struct *remove_vm_area(const void *addr) might_sleep(); spin_lock(&vmap_area_lock); - va = __find_vmap_area((unsigned long)addr); + va = __find_vmap_area((unsigned long)addr, &vmap_area_root); if (va && va->vm) { struct vm_struct *vm = va->vm;