From patchwork Sat Jan 21 07:10:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13111012 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 744C3C25B50 for ; Sat, 21 Jan 2023 07:11:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0EB356B007D; Sat, 21 Jan 2023 02:11:17 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 099246B007E; Sat, 21 Jan 2023 02:11:17 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E2F066B0080; Sat, 21 Jan 2023 02:11:16 -0500 (EST) 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 D446C6B007D for ; Sat, 21 Jan 2023 02:11:16 -0500 (EST) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id B0B791A05EA for ; Sat, 21 Jan 2023 07:11:16 +0000 (UTC) X-FDA: 80377934952.02.9E293EE Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf11.hostedemail.com (Postfix) with ESMTP id 1E0E340005 for ; Sat, 21 Jan 2023 07:11:14 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=VeEOKHCn; dmarc=none; spf=none (imf11.hostedemail.com: domain of BATV+1651c3ebed9361b307e7+7090+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+1651c3ebed9361b307e7+7090+infradead.org+hch@bombadil.srs.infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1674285075; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=CBsCp/QzNVZu+9wjEps4s2+qTeM/ys5OZl1OD4aXEDs=; b=pil91iPwS+DxvUJKrM9KsDHdrY2TxfN48sV3fNznwfZod7RxmsbHeSkBsZR0U77YZSEyMr tTupVyYsti5F3r/V8qvqZ3fQ5iI9p8e14FJV12fmnye3Cx1q1VGi7KF3Tp+4gmBppLi/+r xYd/7F6r0qaOUtafkbLfhat1mxD2MT0= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=VeEOKHCn; dmarc=none; spf=none (imf11.hostedemail.com: domain of BATV+1651c3ebed9361b307e7+7090+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+1651c3ebed9361b307e7+7090+infradead.org+hch@bombadil.srs.infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1674285075; a=rsa-sha256; cv=none; b=W++2NFnr+3UI4Kl98gwViC0V9vu3WD93FSMa1144uQ4iq2wIz+dX1Eze/gIyj42YmkrPxj X3/aGI68Jrg4e6bPyvfGHFlJJrxKSE7yXeWjw9P8Kmqtav5B7iYRV/tTnSo2uvEpB+y4ST dM3v5hMGzYONrT+7pefK4M8o5oTMlIo= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=CBsCp/QzNVZu+9wjEps4s2+qTeM/ys5OZl1OD4aXEDs=; b=VeEOKHCnO6cmqihYY0yoJCG4Bi hHznZSK3OqyifQO3u6IYqonjoYHP1eVgrMXN969MoevSuAj7lAtKAMsZuSfwIr23BGuA9dLHbiPp5 PGiPU5iEA6n9FmTDpCeU4sjX9r9vuTFa0fgpUhX8CAOE/cb3fFdvxdqXtPv6zCkUXAlKSwuR3pzL+ XzUqiHnjd70YVfKCftZIMqFu3L1JUPtpRPaYccbuDg/m87FUFjAwXnio/YtLhusPlx9/n/rwxseHK jg0zY11p/HR85+xDO8X40WESdC4zyXl7lVc2jkytI0sH3/xgs84GrvSMZ/DrYhX7YHfnhIW/IT/qF fwPkA2bw==; Received: from [2001:4bb8:19a:2039:6754:cc81:9ace:36fc] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1pJ81t-00DTpv-53; Sat, 21 Jan 2023 07:11:09 +0000 From: Christoph Hellwig To: Andrew Morton , Uladzislau Rezki Cc: Andrey Ryabinin , Alexander Potapenko , Andrey Konovalov , Dmitry Vyukov , Vincenzo Frascino , kasan-dev@googlegroups.com, linux-mm@kvack.org Subject: [PATCH 06/10] mm: move __remove_vm_area out of va_remove_mappings Date: Sat, 21 Jan 2023 08:10:47 +0100 Message-Id: <20230121071051.1143058-7-hch@lst.de> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230121071051.1143058-1-hch@lst.de> References: <20230121071051.1143058-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Rspamd-Queue-Id: 1E0E340005 X-Rspamd-Server: rspam09 X-Rspam-User: X-Stat-Signature: ajkpandewb6ax9fnw8qa4kra3jukt1xw X-HE-Tag: 1674285074-440241 X-HE-Meta: U2FsdGVkX18WIhwG40AWnxBtG2QazyScCDsi/PSG+X7NboI728pReI0UcHXPqIx2GYkh4LC2pmwzAp5+vO+I9n++daeCcyQXRCGjBirGWDYgNt6aLkmJXVIbYwn94tEewOE6kMvNJWKY8wS9N5AwXY3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eryzmLESY6ezA/zQPvg75w6+UkmoTgiWE1mL1aF45A0Co/UsI36aenNb3TU+c9jCtNpdKSu6rHVr4jppmlM2MRgUDFJV1IF+wLFKuzLioCWwhhKgkw6EI7MdBFuWnJOF4I7Oh3Y72Pt226EL1T3tqARzuoOOZLQPzGbrmXkwAKWat3/conBevTxlyM0CFzOAsTGt2Ea9wO69uzedgLagy7GnfT44n/DJ64zK/lHz4k2WxJPTfpP5A6T/sxuIb2wij4cDc0cvtq5h1hJoFtefa1nGkglPuUgYpL1NnN9zfCtZm5NXxB+hhYYqnO7T1vve6GMmoWAxWq3Y4oC8HOizu9oS9 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: __remove_vm_area is the only part of va_remove_mappings that requires a vmap_area. Move the call out to the caller and only pass the vm_struct to va_remove_mappings. Signed-off-by: Christoph Hellwig Reviewed-by: Uladzislau Rezki (Sony) Reviewed-by: David Hildenbrand --- mm/vmalloc.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/mm/vmalloc.c b/mm/vmalloc.c index 3c07520b8b821b..ee0d641019c30b 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -2614,18 +2614,15 @@ static inline void set_area_direct_map(const struct vm_struct *area, set_direct_map(area->pages[i]); } -/* Handle removing and resetting vm mappings related to the VA's vm_struct. */ -static void va_remove_mappings(struct vmap_area *va, int deallocate_pages) +/* Handle removing and resetting vm mappings related to the vm_struct. */ +static void vm_remove_mappings(struct vm_struct *area, int deallocate_pages) { - struct vm_struct *area = va->vm; unsigned long start = ULONG_MAX, end = 0; unsigned int page_order = vm_area_page_order(area); int flush_reset = area->flags & VM_FLUSH_RESET_PERMS; int flush_dmap = 0; int i; - __remove_vm_area(va); - /* If this is not VM_FLUSH_RESET_PERMS memory, no need for the below. */ if (!flush_reset) return; @@ -2691,7 +2688,8 @@ static void __vunmap(const void *addr, int deallocate_pages) kasan_poison_vmalloc(area->addr, get_vm_area_size(area)); - va_remove_mappings(va, deallocate_pages); + __remove_vm_area(va); + vm_remove_mappings(area, deallocate_pages); if (deallocate_pages) { int i;