From: David Hildenbrand <david@redhat.com>
To: Christoph Hellwig <hch@lst.de>,
Andrew Morton <akpm@linux-foundation.org>
Cc: Dexuan Cui <decui@microsoft.com>,
Vitaly Kuznetsov <vkuznets@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will@kernel.org>, Jessica Yu <jeyu@kernel.org>,
x86@kernel.org, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org,
linux-mm@kvack.org
Subject: Re: [PATCH 3/3] mm: remove vmalloc_exec
Date: Thu, 18 Jun 2020 10:53:08 +0200 [thread overview]
Message-ID: <50a0372c-8498-4d42-3621-bcde3f2746c8@redhat.com> (raw)
In-Reply-To: <20200618064307.32739-4-hch@lst.de>
On 18.06.20 08:43, Christoph Hellwig wrote:
> Merge vmalloc_exec into its only caller. Note that for !CONFIG_MMU
> __vmalloc_node_range maps to __vmalloc, which directly clears the
> __GFP_HIGHMEM added by the vmalloc_exec stub anyway.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
> include/linux/vmalloc.h | 1 -
> kernel/module.c | 4 +++-
> mm/nommu.c | 17 -----------------
> mm/vmalloc.c | 20 --------------------
> 4 files changed, 3 insertions(+), 39 deletions(-)
>
> diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h
> index 48bb681e6c2aed..0221f852a7e1a3 100644
> --- a/include/linux/vmalloc.h
> +++ b/include/linux/vmalloc.h
> @@ -106,7 +106,6 @@ extern void *vzalloc(unsigned long size);
> extern void *vmalloc_user(unsigned long size);
> extern void *vmalloc_node(unsigned long size, int node);
> extern void *vzalloc_node(unsigned long size, int node);
> -extern void *vmalloc_exec(unsigned long size);
> extern void *vmalloc_32(unsigned long size);
> extern void *vmalloc_32_user(unsigned long size);
> extern void *__vmalloc(unsigned long size, gfp_t gfp_mask);
> diff --git a/kernel/module.c b/kernel/module.c
> index e8a198588f26ee..0c6573b98c3662 100644
> --- a/kernel/module.c
> +++ b/kernel/module.c
> @@ -2783,7 +2783,9 @@ static void dynamic_debug_remove(struct module *mod, struct _ddebug *debug)
>
> void * __weak module_alloc(unsigned long size)
> {
> - return vmalloc_exec(size);
> + return __vmalloc_node_range(size, 1, VMALLOC_START, VMALLOC_END,
> + GFP_KERNEL, PAGE_KERNEL_EXEC, VM_FLUSH_RESET_PERMS,
> + NUMA_NO_NODE, __func__);
> }
>
> bool __weak module_init_section(const char *name)
> diff --git a/mm/nommu.c b/mm/nommu.c
> index cdcad5d61dd194..f32a69095d509e 100644
> --- a/mm/nommu.c
> +++ b/mm/nommu.c
> @@ -290,23 +290,6 @@ void *vzalloc_node(unsigned long size, int node)
> }
> EXPORT_SYMBOL(vzalloc_node);
>
> -/**
> - * vmalloc_exec - allocate virtually contiguous, executable memory
> - * @size: allocation size
> - *
> - * Kernel-internal function to allocate enough pages to cover @size
> - * the page level allocator and map them into contiguous and
> - * executable kernel virtual space.
> - *
> - * For tight control over page level allocator and protection flags
> - * use __vmalloc() instead.
> - */
> -
> -void *vmalloc_exec(unsigned long size)
> -{
> - return __vmalloc(size, GFP_KERNEL | __GFP_HIGHMEM);
> -}
> -
> /**
> * vmalloc_32 - allocate virtually contiguous memory (32bit addressable)
> * @size: allocation size
> diff --git a/mm/vmalloc.c b/mm/vmalloc.c
> index 3091c2ca60dfd1..f60948aac0d0e4 100644
> --- a/mm/vmalloc.c
> +++ b/mm/vmalloc.c
> @@ -2696,26 +2696,6 @@ void *vzalloc_node(unsigned long size, int node)
> }
> EXPORT_SYMBOL(vzalloc_node);
>
> -/**
> - * vmalloc_exec - allocate virtually contiguous, executable memory
> - * @size: allocation size
> - *
> - * Kernel-internal function to allocate enough pages to cover @size
> - * the page level allocator and map them into contiguous and
> - * executable kernel virtual space.
> - *
> - * For tight control over page level allocator and protection flags
> - * use __vmalloc() instead.
> - *
> - * Return: pointer to the allocated memory or %NULL on error
> - */
> -void *vmalloc_exec(unsigned long size)
> -{
> - return __vmalloc_node_range(size, 1, VMALLOC_START, VMALLOC_END,
> - GFP_KERNEL, PAGE_KERNEL_EXEC, VM_FLUSH_RESET_PERMS,
> - NUMA_NO_NODE, __builtin_return_address(0));
> -}
> -
> #if defined(CONFIG_64BIT) && defined(CONFIG_ZONE_DMA32)
> #define GFP_VMALLOC32 (GFP_DMA32 | GFP_KERNEL)
> #elif defined(CONFIG_64BIT) && defined(CONFIG_ZONE_DMA)
>
LGTM
Reviewed-by: David Hildenbrand <david@redhat.com>
--
Thanks,
David / dhildenb
next prev parent reply other threads:[~2020-06-18 8:53 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-18 6:43 fix a hyperv W^X violation and remove vmalloc_exec Christoph Hellwig
2020-06-18 6:43 ` [PATCH 1/3] x86/hyperv: allocate the hypercall page with only read and execute bits Christoph Hellwig
2020-06-18 11:47 ` Wei Liu
2020-06-18 6:43 ` [PATCH 2/3] arm64: use PAGE_KERNEL_ROX directly in alloc_insn_page Christoph Hellwig
2020-06-18 8:55 ` David Hildenbrand
2020-06-18 10:35 ` Peter Zijlstra
2020-06-18 13:50 ` Christoph Hellwig
2020-06-18 9:27 ` Peter Zijlstra
2020-06-21 2:16 ` Andrew Morton
2020-06-23 9:05 ` Christoph Hellwig
2020-06-23 9:07 ` Will Deacon
2020-06-23 9:37 ` Peter Zijlstra
2020-06-23 9:57 ` Will Deacon
2020-06-27 7:34 ` Ard Biesheuvel
2020-06-27 7:56 ` Christoph Hellwig
2020-06-27 7:57 ` Ard Biesheuvel
2020-06-18 6:43 ` [PATCH 3/3] mm: remove vmalloc_exec Christoph Hellwig
2020-06-18 8:53 ` David Hildenbrand [this message]
2020-06-18 9:28 ` fix a hyperv W^X violation and " Peter Zijlstra
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=50a0372c-8498-4d42-3621-bcde3f2746c8@redhat.com \
--to=david@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=catalin.marinas@arm.com \
--cc=decui@microsoft.com \
--cc=hch@lst.de \
--cc=jeyu@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-hyperv@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=peterz@infradead.org \
--cc=vkuznets@redhat.com \
--cc=will@kernel.org \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).