diff options
| author | Kees Cook <kees@kernel.org> | 2025-05-15 14:42:15 -0700 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2025-05-29 11:03:23 +0200 |
| commit | 94efb0d6569029ab2a554309dafaba6b95e97869 (patch) | |
| tree | c3a0abeb57da0f7ae028630e57a2a813ab11b93c | |
| parent | 9f9517f15686652036909400d954cd236365d8b8 (diff) | |
| download | linux-94efb0d6569029ab2a554309dafaba6b95e97869.tar.gz linux-94efb0d6569029ab2a554309dafaba6b95e97869.tar.bz2 linux-94efb0d6569029ab2a554309dafaba6b95e97869.zip | |
mm: vmalloc: actually use the in-place vrealloc region
commit f7a35a3c36d1e36059c5654737d9bee3454f01a3 upstream.
Patch series "mm: vmalloc: Actually use the in-place vrealloc region".
This fixes a performance regression[1] with vrealloc()[1].
The refactoring to not build a new vmalloc region only actually worked
when shrinking. Actually return the resized area when it grows. Ugh.
Link: https://lkml.kernel.org/r/20250515214217.619685-1-kees@kernel.org
Fixes: a0309faf1cb0 ("mm: vmalloc: support more granular vrealloc() sizing")
Signed-off-by: Kees Cook <kees@kernel.org>
Reported-by: Shung-Hsi Yu <shung-hsi.yu@suse.com>
Closes: https://lore.kernel.org/all/20250515-bpf-verifier-slowdown-vwo2meju4cgp2su5ckj@6gi6ssxbnfqg [1]
Tested-by: Eduard Zingerman <eddyz87@gmail.com>
Tested-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
Tested-by: Shung-Hsi Yu <shung-hsi.yu@suse.com>
Reviewed-by: "Uladzislau Rezki (Sony)" <urezki@gmail.com>
Reviewed-by: Danilo Krummrich <dakr@kernel.org>
Cc: "Erhard F." <erhard_f@mailbox.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| -rw-r--r-- | mm/vmalloc.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/mm/vmalloc.c b/mm/vmalloc.c index 358bd3083b88..d7b15cf9f2cc 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -4115,6 +4115,7 @@ void *vrealloc_noprof(const void *p, size_t size, gfp_t flags) if (want_init_on_alloc(flags)) memset((void *)p + old_size, 0, size - old_size); vm->requested_size = size; + return (void *)p; } /* TODO: Grow the vm_area, i.e. allocate and map additional pages. */ |
