linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Corbet <corbet@lwn.net>
To: Vlastimil Babka <vbabka@suse.cz>,
	David Rientjes <rientjes@google.com>,
	Christoph Lameter <cl@linux.com>
Cc: Hyeonggon Yoo <42.hyeyoo@gmail.com>,
	Roman Gushchin <roman.gushchin@linux.dev>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-mm@kvack.org, linux-doc@vger.kernel.org,
	Vlastimil Babka <vbabka@suse.cz>
Subject: Re: [PATCH] mm, slab: add kerneldocs for common SLAB_ flags
Date: Wed, 09 Oct 2024 09:08:31 -0600	[thread overview]
Message-ID: <878quxe2kw.fsf@trenco.lwn.net> (raw)
In-Reply-To: <20241009142936.56092-2-vbabka@suse.cz>

Vlastimil Babka <vbabka@suse.cz> writes:

> We have many SLAB_ flags but many are used only internally, by kunit
> tests or debugging subsystems cooperating with slab, or are set
> according to slab_debug boot parameter.
>
> Create kerneldocs for the commonly used flags that may be passed to
> kmem_cache_create(). SLAB_TYPESAFE_BY_RCU already had a detailed
> description, so turn it to a kerneldoc. Add some details for
> SLAB_ACCOUNT, SLAB_RECLAIM_ACCOUNT and SLAB_HWCACHE_ALIGN. Reference
> them from the __kmem_cache_create_args() kerneldoc.
>
> Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
> ---
> I plan to take this in the slab tree, but a question for Jon/linux-doc:
>
> I think I'm doing properly the "Object-like macro documentation" for
> parameter-less macros from the doc-guide. Yet I can see in the htmldocs
> things like "SLAB_TYPESAFE_BY_RCU ()" and "Parameters". Is there a bug
> in the sphinx machinery? Thanks.

No, it's totally bug-free and any appearance to the contrary is entirely
in your imagination :)

I don't think anybody has tried to do kerneldoc for macros that don't
look like functions; it doesn't surprise me that it doesn't work right. 

>  include/linux/slab.h | 60 ++++++++++++++++++++++++++++++--------------
>  mm/slab_common.c     | 14 ++++++++++-
>  2 files changed, 54 insertions(+), 20 deletions(-)
>
> diff --git a/include/linux/slab.h b/include/linux/slab.h
> index b35e2db7eb0e..49e9fb93e864 100644
> --- a/include/linux/slab.h
> +++ b/include/linux/slab.h
> @@ -77,7 +77,17 @@ enum _slab_flag_bits {
>  #define SLAB_POISON		__SLAB_FLAG_BIT(_SLAB_POISON)
>  /* Indicate a kmalloc slab */
>  #define SLAB_KMALLOC		__SLAB_FLAG_BIT(_SLAB_KMALLOC)
> -/* Align objs on cache lines */
> +/**
> + * define SLAB_HWCACHE_ALIGN - Align objects on cache line boundaries.
> + *
> + * Sufficiently large objects are aligned on cache line boundary. For object
> + * size smaller than a half of cache line size, the alignment is on the half of
> + * cache line size. In general, if object size is smaller than 1/2^n of cache
> + * line size, the alignment is adjusted to 1/2^n.

I'm kind of surprised that kernel-doc doesn't complain about that; it's
definitely not something that was ever envisioned, as far as I know.

Making it work properly probably requires somebody to wander into Perl
regex hell.  In the short term, if you want to get this text into the
rendered docs, the usual approach is to make a DOC: block out of it and
include it explicitly.

Thanks,

jon


  reply	other threads:[~2024-10-09 15:08 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-09 14:29 Vlastimil Babka
2024-10-09 15:08 ` Jonathan Corbet [this message]
2024-10-09 16:11   ` Vlastimil Babka
2024-10-09 16:49     ` Jonathan Corbet
2024-10-09 22:02       ` Randy Dunlap
2024-10-10  5:06         ` Randy Dunlap
2024-10-10 23:43           ` [partial fix] " Randy Dunlap
2024-10-10 23:54             ` Randy Dunlap
2024-10-11  3:07               ` Randy Dunlap
2024-10-11 22:16                 ` Randy Dunlap

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=878quxe2kw.fsf@trenco.lwn.net \
    --to=corbet@lwn.net \
    --cc=42.hyeyoo@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=cl@linux.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=rientjes@google.com \
    --cc=roman.gushchin@linux.dev \
    --cc=vbabka@suse.cz \
    /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