linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/slub: drop duplicate kernel-doc for ksize()
@ 2026-02-20 12:42 Sanjay Chitroda
  2026-02-22  3:47 ` David Rientjes
  2026-02-23 15:16 ` Matthew Wilcox
  0 siblings, 2 replies; 4+ messages in thread
From: Sanjay Chitroda @ 2026-02-20 12:42 UTC (permalink / raw)
  To: Vlastimil Babka, Andrew Morton
  Cc: Christoph Lameter, David Rientjes, Roman Gushchin, Harry Yoo,
	linux-mm, linux-kernel, Sanjay Chitroda

From: Sanjay Chitroda <sanjayembeddedse@gmail.com>

The ksize() API is already documented in the public header, and
Documentation/core-api/mm-api.rst pulls that canonical doc into the
book. The kernel-doc block added to mm/slub.c by commit
fab0694646d7 ("mm/slab: move [__]ksize and slab_ksize() to mm/slub.c")
introduced a second definition for the same symbol in the generated
docs, which makes Sphinx emit:

  WARNING: Duplicate C declaration, also defined at core-api/mm-api:521
  Declaration is '.. c:function:: size_t ksize(const void *objp)'

Remove the redundant kernel-doc comment from slub.c so only the
header-provided documentation is emitted. This keeps the user-visible
API documentation intact while eliminating the duplicate-declaration
warning during `make htmldocs`.

No functional change.

Fixes: fab0694646d7 ("mm/slab: move [__]ksize and slab_ksize() to mm/slub.c")
Signed-off-by: Sanjay Chitroda <sanjayembeddedse@gmail.com>
---
 mm/slub.c | 12 ------------
 1 file changed, 12 deletions(-)

diff --git a/mm/slub.c b/mm/slub.c
index 865bc050f654..3f58a485e95e 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -6309,18 +6309,6 @@ static size_t __ksize(const void *object)
 	return slab_ksize(slab);
 }
 
-/**
- * ksize -- Report full size of underlying allocation
- * @objp: pointer to the object
- *
- * This should only be used internally to query the true size of allocations.
- * It is not meant to be a way to discover the usable size of an allocation
- * after the fact. Instead, use kmalloc_size_roundup(). Using memory beyond
- * the originally requested allocation size may trigger KASAN, UBSAN_BOUNDS,
- * and/or FORTIFY_SOURCE.
- *
- * Return: size of the actual memory used by @objp in bytes
- */
 size_t ksize(const void *objp)
 {
 	/*
-- 
2.34.1



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mm/slub: drop duplicate kernel-doc for ksize()
  2026-02-20 12:42 [PATCH] mm/slub: drop duplicate kernel-doc for ksize() Sanjay Chitroda
@ 2026-02-22  3:47 ` David Rientjes
  2026-02-23 13:21   ` Sanjay Chitroda
  2026-02-23 15:16 ` Matthew Wilcox
  1 sibling, 1 reply; 4+ messages in thread
From: David Rientjes @ 2026-02-22  3:47 UTC (permalink / raw)
  To: Sanjay Chitroda
  Cc: Vlastimil Babka, Andrew Morton, Christoph Lameter,
	Roman Gushchin, Harry Yoo, linux-mm, linux-kernel

On Fri, 20 Feb 2026, Sanjay Chitroda wrote:

> From: Sanjay Chitroda <sanjayembeddedse@gmail.com>
> 
> The ksize() API is already documented in the public header, and
> Documentation/core-api/mm-api.rst pulls that canonical doc into the
> book. The kernel-doc block added to mm/slub.c by commit
> fab0694646d7 ("mm/slab: move [__]ksize and slab_ksize() to mm/slub.c")
> introduced a second definition for the same symbol in the generated
> docs, which makes Sphinx emit:
> 
>   WARNING: Duplicate C declaration, also defined at core-api/mm-api:521
>   Declaration is '.. c:function:: size_t ksize(const void *objp)'
> 
> Remove the redundant kernel-doc comment from slub.c so only the
> header-provided documentation is emitted. This keeps the user-visible
> API documentation intact while eliminating the duplicate-declaration
> warning during `make htmldocs`.
> 
> No functional change.
> 
> Fixes: fab0694646d7 ("mm/slab: move [__]ksize and slab_ksize() to mm/slub.c")
> Signed-off-by: Sanjay Chitroda <sanjayembeddedse@gmail.com>

The header file kernel-doc looks equivalent without mentioning that it 
returns bytes.  Might be best to make that clear in slab.h?


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mm/slub: drop duplicate kernel-doc for ksize()
  2026-02-22  3:47 ` David Rientjes
@ 2026-02-23 13:21   ` Sanjay Chitroda
  0 siblings, 0 replies; 4+ messages in thread
From: Sanjay Chitroda @ 2026-02-23 13:21 UTC (permalink / raw)
  To: David Rientjes
  Cc: Vlastimil Babka, Andrew Morton, Christoph Lameter,
	Roman Gushchin, Harry Yoo, linux-mm, linux-kernel,
	Sanjay Chitroda

> The header file kernel-doc looks equivalent without mentioning that it
> returns bytes.  Might be best to make that clear in slab.h?

shall we add dedicated change in slab.h to add return bytes information?
this would keep this change as clean, what do you suggest?



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mm/slub: drop duplicate kernel-doc for ksize()
  2026-02-20 12:42 [PATCH] mm/slub: drop duplicate kernel-doc for ksize() Sanjay Chitroda
  2026-02-22  3:47 ` David Rientjes
@ 2026-02-23 15:16 ` Matthew Wilcox
  1 sibling, 0 replies; 4+ messages in thread
From: Matthew Wilcox @ 2026-02-23 15:16 UTC (permalink / raw)
  To: Sanjay Chitroda
  Cc: Vlastimil Babka, Andrew Morton, Christoph Lameter,
	David Rientjes, Roman Gushchin, Harry Yoo, linux-mm,
	linux-kernel

On Fri, Feb 20, 2026 at 06:12:43PM +0530, Sanjay Chitroda wrote:
> The ksize() API is already documented in the public header, and
> Documentation/core-api/mm-api.rst pulls that canonical doc into the
> book. The kernel-doc block added to mm/slub.c by commit
> fab0694646d7 ("mm/slab: move [__]ksize and slab_ksize() to mm/slub.c")
> introduced a second definition for the same symbol in the generated
> docs, which makes Sphinx emit:
> 
>   WARNING: Duplicate C declaration, also defined at core-api/mm-api:521
>   Declaration is '.. c:function:: size_t ksize(const void *objp)'
> 
> Remove the redundant kernel-doc comment from slub.c so only the

Usually we keep the kernel-doc comment with the implementation, not with
the prototype.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-02-23 15:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-02-20 12:42 [PATCH] mm/slub: drop duplicate kernel-doc for ksize() Sanjay Chitroda
2026-02-22  3:47 ` David Rientjes
2026-02-23 13:21   ` Sanjay Chitroda
2026-02-23 15:16 ` Matthew Wilcox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox