Re: [PATCH 2/2] vfree: Update documentation

From: Christoph Hellwig
Date: Tue Sep 22 2020 - 10:35:11 EST


On Mon, Sep 21, 2020 at 11:46:28PM +0100, Matthew Wilcox (Oracle) wrote:
> * Document that you can call vfree() on an address returned from vmap()
> * Remove the note about the minimum size -- the minimum size of a vmalloc
> allocation is one page
> * Add a Context: section
> * Fix capitalisation
> * Reword the prohibition on calling from NMI context to avoid a double
> negative
>
> Signed-off-by: Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx>
> ---
> mm/vmalloc.c | 20 ++++++++++----------
> 1 file changed, 10 insertions(+), 10 deletions(-)
>
> diff --git a/mm/vmalloc.c b/mm/vmalloc.c
> index 3893fc8915c4..942a44bdeec6 100644
> --- a/mm/vmalloc.c
> +++ b/mm/vmalloc.c
> @@ -2313,20 +2313,20 @@ static void __vfree(const void *addr)
> }
>
> /**
> - * vfree - release memory allocated by vmalloc()
> - * @addr: memory base address
> + * vfree - Release memory allocated by vmalloc()
> + * @addr: Memory base address
> *
> * Free the virtually continuous memory area starting at @addr, as
> + * obtained from vmalloc(), vmalloc_32() or __vmalloc(). If called
> + * on an @addr obtained from vmap(), it will put one refcount on each
> + * mapped page, which will free the page if this is the last refcount
> + * on the page. If @addr is NULL, no operation is performed.

This reads a little confusing. First it only allows vmalloc* and
then it mentions vmap in the next sentence. And what about
vmalloc_32_user, vzalloc_node, vmalloc_node, vmalloc_user, vzalloc and
__vmalloc_node?