linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Vlastimil Babka <vbabka@suse.cz>
To: zhaoxinchao <ChrisXinchao@outlook.com>
Cc: akpm@linux-foundation.org, bagasdotme@gmail.com, cl@linux.com,
	iamjoonsoo.kim@lge.com, linux-kernel@vger.kernel.org,
	linux-mm@kvack.org, penberg@kernel.org, rientjes@google.com
Subject: Re: [PATCH v3] mm: Fixed incorrect comment for _kmem_cache_create function
Date: Tue, 18 Apr 2023 09:10:07 +0200	[thread overview]
Message-ID: <031c79dd-1927-0d81-bfef-6dc64adcad12@suse.cz> (raw)
In-Reply-To: <DM6PR22MB1836E82FB689EE68B8065C47C59D9@DM6PR22MB1836.namprd22.prod.outlook.com>

On 4/18/23 04:05, zhaoxinchao wrote:
> From: zhaoxinchao <chrisxinchao@outlook.com>
> 
> 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.

Adjusted a bit.

> Signed-off-by: zhaoxinchao <chrisxinchao@outlook.com>
> ---
>  mm/slab.c | 13 +++++++------
>  1 file changed, 7 insertions(+), 6 deletions(-)
> 
> diff --git a/mm/slab.c b/mm/slab.c
> index edbe722fb..ebd326f07 100644
> --- a/mm/slab.c
> +++ b/mm/slab.c
> @@ -1888,14 +1888,17 @@ static bool set_on_slab_cache(struct kmem_cache *cachep,
>  	return true;
>  }
>  
> -/**
> +/*
>   * __kmem_cache_create - Create a cache.
>   * @cachep: cache management descriptor
>   * @flags: SLAB flags
>   *
> - * Returns a ptr to the cache on success, NULL on failure.
> - * Cannot be called within an int, but can be interrupted.
> - * The @ctor is run when new pages are allocated by the cache.
> + * Returns zero on success, nonzero on failure.
> + * 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.

In v2 I recommended dropping the detailed description. Removed it when
merging. The result is merged for 6.5 here:

https://git.kernel.org/pub/scm/linux/kernel/git/vbabka/slab.git/log/?h=slab/for-6.5/trivial

Thanks!

>   *
>   * The flags are
>   *
> @@ -1908,8 +1911,6 @@ static bool set_on_slab_cache(struct kmem_cache *cachep,
>   * %SLAB_HWCACHE_ALIGN - Align the objects in this cache to a hardware
>   * cacheline.  This can be beneficial if you're counting cycles as closely
>   * as davem.
> - *
> - * 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)
>  {



      reply	other threads:[~2023-04-18  7:10 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-10  9:01 [PATCH] " zhaoxinchao
2023-04-10 14:05 ` Bagas Sanjaya
2023-04-11  9:13   ` [PATCH v2] " zhaoxinchao
2023-04-12  3:40     ` Bagas Sanjaya
2023-04-12  6:17       ` 答复: " zhao xinchao
2023-04-17 15:47     ` Vlastimil Babka
2023-04-18  2:05       ` [PATCH v3] " zhaoxinchao
2023-04-18  7:10         ` Vlastimil Babka [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=031c79dd-1927-0d81-bfef-6dc64adcad12@suse.cz \
    --to=vbabka@suse.cz \
    --cc=ChrisXinchao@outlook.com \
    --cc=akpm@linux-foundation.org \
    --cc=bagasdotme@gmail.com \
    --cc=cl@linux.com \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=penberg@kernel.org \
    --cc=rientjes@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox