Re: [PATCH] mm, slab: add kerneldocs for common SLAB_ flags

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

 



Vlastimil Babka <vbabka@xxxxxxx> 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@xxxxxxx>
> ---
> 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




[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