Re: [PATCH 1/2] mm: vmalloc: implement vrealloc()
From: Christoph Hellwig
Date: Wed Jul 17 2024 - 23:16:46 EST
On Thu, Jul 18, 2024 at 12:24:01AM +0200, Danilo Krummrich wrote:
> +extern void * __must_check vrealloc_noprof(const void *p, size_t size,
> + gfp_t flags) __realloc_size(2);
No need for the extern here.
It would also help readability a bit to keep the __realloc_size on a
separate like, aka:
void *__must_check vrealloc_noprof(const void *p, size_t size, gfp_t flags)
__realloc_size(2);
> + if (size <= old_size) {
> + /* TODO: Can we optimize and shrink the allocation? What would
> + * be a good metric for when to shrink the vm_area?
> + */
Kernel comment style is to keep the
/*
on a line of it's own. A realloc that doesn't shrink is a bit
pointless. The same heuristics as for krealloc should probably apply
here, adjust to the fact that we always deal with whole pages.
> + /* TODO: Can we optimize and extend the existing allocation if we have
> + * enough contiguous space left in the virtual address space?
> + */
I don't understand this comment.
> +EXPORT_SYMBOL(vrealloc_noprof);
New interfaces should be EXPORT_SYMBOL_GPL. That being said for this
to be added an exported we'll need an actual user to start with anyway.