Re: [PATCH v2] mm: Fixed incorrect comment for _kmem_cache_create function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 4/11/23 11:13, zhaoxinchao wrote:
> From: zhaoxinchao <chrisxinchao@xxxxxxxxxxx>
> 
> Actually __kmem_cache_create() returns a status :
> 0 is success
> nonezero are failed.
> 
> This function has three return positions. In addition to successfully
> return 0, the first failed position will return - E2BIG, and the second
> position will return nonzero value for setup_cpu_cache function failure.
> 
> Signed-off-by: zhaoxinchao <chrisxinchao@xxxxxxxxxxx>
> ---
>  mm/slab.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/mm/slab.c b/mm/slab.c
> index edbe722fb..399daa4d0 100644
> --- a/mm/slab.c
> +++ b/mm/slab.c
> @@ -1893,7 +1893,12 @@ static bool set_on_slab_cache(struct kmem_cache *cachep,
>   * @cachep: cache management descriptor
>   * @flags: SLAB flags
>   *
> - * Returns a ptr to the cache on success, NULL on failure.
> + * Returns zero on success, nonzero on failure.

OK.

> + * This function has three return positions.
> + * In addition to successfully return 0, the
> + * first failed position will return - E2BIG,
> + * and the second position will return nonzero
> + * value for setup_cpu_cache function failure.

I don't think we need to be so specific here, so we can drop this block.

>   * Cannot be called within an int, but can be interrupted.
>   * The @ctor is run when new pages are allocated by the cache.
>   *

You missed that there's also:

 * Return: a pointer to the created cache or %NULL in case of error
 */
int __kmem_cache_create(struct kmem_cache *cachep, slab_flags_t flags)

I guess we can drop the first mention of returns and fix up this one.
Also I'd make this a non-kerneldoc comment (/* instead of /**) as
it's for a SLAB-specific internal implementation only. Only
kmem_cache_create() is meant as an API.




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux