From patchwork Thu Jan 19 10:02:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13107654 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 755CEC00A5A for ; Thu, 19 Jan 2023 10:06:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 12F876B0082; Thu, 19 Jan 2023 05:06:31 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 0E0098E0001; Thu, 19 Jan 2023 05:06:31 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EE9D06B0085; Thu, 19 Jan 2023 05:06:30 -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 E12396B0082 for ; Thu, 19 Jan 2023 05:06:30 -0500 (EST) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id C25FAC0CFE for ; Thu, 19 Jan 2023 10:06:30 +0000 (UTC) X-FDA: 80371118940.01.45A36ED Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf21.hostedemail.com (Postfix) with ESMTP id 5266D1C000B for ; Thu, 19 Jan 2023 10:06:29 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=kV37HWuz; spf=none (imf21.hostedemail.com: domain of BATV+d6c99cb0ec1a2cfa7d20+7088+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+d6c99cb0ec1a2cfa7d20+7088+infradead.org+hch@bombadil.srs.infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1674122789; 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=j7jaCYzdOgDTuecb3mgn/VwQXE5kJbITGLcmpq6VV5U=; b=dL71aAOG9wpZnA4cBHSnbOJHOREfapIdUMMgdJqWjHGf0QWZSKkmtC7xb2GWyZELDHbBFE OYQS3+fCZ2a2Wux9B5OmJTjFu5qiYTo8Y3DwFwl+rUL5e6v+bOeDhjMJfAQ7n0Np2JdhiO OwRt6GvpSt82cuXW4rDS0IHGngYeW20= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=kV37HWuz; spf=none (imf21.hostedemail.com: domain of BATV+d6c99cb0ec1a2cfa7d20+7088+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+d6c99cb0ec1a2cfa7d20+7088+infradead.org+hch@bombadil.srs.infradead.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1674122789; a=rsa-sha256; cv=none; b=e6cZXOVYVTVNFJboDGLDYa2iyW681RGCqEFQ6hfb18XNa8hUKWdM26x6F+Nn+GqDh2rtZI Ynkw3GhkN3d0I0QQxSokmuD5s2NOzP5c9Ai0VocY3qK+xw//C9K0LF0qtLB8AxGIYiJfnh G9gNypVer5IKkDYb0dX6BWqrYhS4e5w= 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=j7jaCYzdOgDTuecb3mgn/VwQXE5kJbITGLcmpq6VV5U=; b=kV37HWuz8zMbPV1zmRBCT+qf6i VB0BjClP5+YX6nJoqfQXvZqjh9yOsqum+Yp/xFaZ21QTRiTMEsixAkdqwvThvFCWds3ndXXCZOJfC Xn9Wn87TKyusqTphHw8K60tqN0P/SCfl8PWrkMc7HF5zB2HwvqJU8WRXamMz233DBXGMrFAuYDWe1 fWnNtBRl0CxLWTi18sqEvwUsQd5UjR5B9Kgk6SM2DwHDhlDPh3e1LL6dhoYnhMiXpd+wZ7JNGJISN BGOEQNuq/51hqjUP2B7V1NPcqCaMqllR7ryrW0JWugUQxYZyHKd4tG/qcAhXqLHm/3DqALkWy3C2+ dBbUwtSQ==; Received: from 089144197172.atnat0006.highway.a1.net ([89.144.197.172] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1pIRoQ-004N5c-VA; Thu, 19 Jan 2023 10:06:27 +0000 From: Christoph Hellwig To: Andrew Morton , Uladzislau Rezki Cc: linux-mm@kvack.org Subject: [PATCH 06/10] mm: move __remove_vm_area out of va_remove_mappings Date: Thu, 19 Jan 2023 11:02:22 +0100 Message-Id: <20230119100226.789506-7-hch@lst.de> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230119100226.789506-1-hch@lst.de> References: <20230119100226.789506-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-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 5266D1C000B X-Stat-Signature: j933ru7edycgy5hmi16w53yfhwky1s9y X-HE-Tag: 1674122789-868585 X-HE-Meta: U2FsdGVkX1+6cgOxXyxEZefPtNuAKNeznQKAv6CLeOM3NZv1SDdKmhKMweJw0cosIwZ84Diaa4kQuvZFY6+hON+80r0ER4yY6U1Bt3c1SPAq1JNAkz66h41sKd8a3Gc9PwfY91+jL6oSZ7JCFEyo7WI6LIgr4e7uWl2bD7pGkD5x+DUp95ccDM1HsauF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=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) --- mm/vmalloc.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/mm/vmalloc.c b/mm/vmalloc.c index 3c07520b8b821b..09c6fcfdaeb7c9 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 va_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); + va_remove_mappings(area, deallocate_pages); if (deallocate_pages) { int i;