Skip to content

Commit 0445ee0

Browse files
committed
mm/slab, docs: switch mm-api docs generation from slab.c to slub.c
The SLAB implementation is going to be removed, and mm-api.rst currently uses mm/slab.c to obtain kerneldocs for some API functions. Switch it to mm/slub.c and move the relevant kerneldocs of exported functions from one to the other. The rest of kerneldocs in slab.c is for static SLAB implementation-specific functions that don't have counterparts in slub.c and thus can be simply removed with the implementation. Acked-by: David Rientjes <[email protected]> Tested-by: David Rientjes <[email protected]> Reviewed-by: Hyeonggon Yoo <[email protected]> Tested-by: Hyeonggon Yoo <[email protected]> Signed-off-by: Vlastimil Babka <[email protected]>
1 parent b85ea95 commit 0445ee0

File tree

3 files changed

+22
-22
lines changed

3 files changed

+22
-22
lines changed

Documentation/core-api/mm-api.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ The Slab Cache
3737
.. kernel-doc:: include/linux/slab.h
3838
:internal:
3939

40-
.. kernel-doc:: mm/slab.c
40+
.. kernel-doc:: mm/slub.c
4141
:export:
4242

4343
.. kernel-doc:: mm/slab_common.c

mm/slab.c

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3491,19 +3491,6 @@ int kmem_cache_alloc_bulk(struct kmem_cache *s, gfp_t flags, size_t size,
34913491
}
34923492
EXPORT_SYMBOL(kmem_cache_alloc_bulk);
34933493

3494-
/**
3495-
* kmem_cache_alloc_node - Allocate an object on the specified node
3496-
* @cachep: The cache to allocate from.
3497-
* @flags: See kmalloc().
3498-
* @nodeid: node number of the target node.
3499-
*
3500-
* Identical to kmem_cache_alloc but it will allocate memory on the given
3501-
* node, which can improve the performance for cpu bound structures.
3502-
*
3503-
* Fallback to other node is possible if __GFP_THISNODE is not set.
3504-
*
3505-
* Return: pointer to the new object or %NULL in case of error
3506-
*/
35073494
void *kmem_cache_alloc_node(struct kmem_cache *cachep, gfp_t flags, int nodeid)
35083495
{
35093496
void *ret = slab_alloc_node(cachep, NULL, flags, nodeid, cachep->object_size, _RET_IP_);
@@ -3564,14 +3551,6 @@ void __kmem_cache_free(struct kmem_cache *cachep, void *objp,
35643551
__do_kmem_cache_free(cachep, objp, caller);
35653552
}
35663553

3567-
/**
3568-
* kmem_cache_free - Deallocate an object
3569-
* @cachep: The cache the allocation was from.
3570-
* @objp: The previously allocated object.
3571-
*
3572-
* Free an object which was previously allocated from this
3573-
* cache.
3574-
*/
35753554
void kmem_cache_free(struct kmem_cache *cachep, void *objp)
35763555
{
35773556
cachep = cache_from_obj(cachep, objp);

mm/slub.c

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3518,6 +3518,19 @@ void *__kmem_cache_alloc_node(struct kmem_cache *s, gfp_t gfpflags,
35183518
caller, orig_size);
35193519
}
35203520

3521+
/**
3522+
* kmem_cache_alloc_node - Allocate an object on the specified node
3523+
* @s: The cache to allocate from.
3524+
* @gfpflags: See kmalloc().
3525+
* @node: node number of the target node.
3526+
*
3527+
* Identical to kmem_cache_alloc but it will allocate memory on the given
3528+
* node, which can improve the performance for cpu bound structures.
3529+
*
3530+
* Fallback to other node is possible if __GFP_THISNODE is not set.
3531+
*
3532+
* Return: pointer to the new object or %NULL in case of error
3533+
*/
35213534
void *kmem_cache_alloc_node(struct kmem_cache *s, gfp_t gfpflags, int node)
35223535
{
35233536
void *ret = slab_alloc_node(s, NULL, gfpflags, node, _RET_IP_, s->object_size);
@@ -3822,6 +3835,14 @@ void __kmem_cache_free(struct kmem_cache *s, void *x, unsigned long caller)
38223835
slab_free(s, virt_to_slab(x), x, NULL, &x, 1, caller);
38233836
}
38243837

3838+
/**
3839+
* kmem_cache_free - Deallocate an object
3840+
* @s: The cache the allocation was from.
3841+
* @x: The previously allocated object.
3842+
*
3843+
* Free an object which was previously allocated from this
3844+
* cache.
3845+
*/
38253846
void kmem_cache_free(struct kmem_cache *s, void *x)
38263847
{
38273848
s = cache_from_obj(s, x);

0 commit comments

Comments
 (0)