diff options
author | Danilo Krummrich <dakr@kernel.org> | 2024-07-17 17:21:17 +0200 |
---|---|---|
committer | Danilo Krummrich <dakr@kernel.org> | 2024-08-13 16:04:19 +0200 |
commit | 4575c0baa19b1a74b307677abbe25b1d6d5be0c3 (patch) | |
tree | 2b5d2d19bd981e52ea46e1bd62092f102adc5e3d /fs/aio.c | |
parent | 590728e3eb28171682aece2cf1d6209024085271 (diff) |
mm: kvmalloc: align kvrealloc() with krealloc()
Besides the obvious (and desired) difference between krealloc() and
kvrealloc(), there is some inconsistency in their function signatures
and behavior:
- krealloc() frees the memory when the requested size is zero, whereas
kvrealloc() simply returns a pointer to the existing allocation.
- krealloc() is self-contained, whereas kvrealloc() relies on the caller
to provide the size of the previous allocation.
Inconsistent behavior throughout allocation APIs is error prone, hence make
kvrealloc() behave like krealloc(), which seems superior in all mentioned
aspects.
Besides that, implementing kvrealloc() by making use of krealloc() and
vrealloc() provides oppertunities to grow (and shrink) allocations more
efficiently. For instance, vrealloc() can be optimized to allocate and
map additional pages to grow the allocation or unmap and free unused
pages to shrink the allocation.
Acked-by: Michal Hocko <mhocko@suse.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
Diffstat (limited to 'fs/aio.c')
0 files changed, 0 insertions, 0 deletions