Create the caches with "calculated" names
Subsystems (2)
PATCH 1/1 Create the caches with "calculated" names
Many code in the kernel needs to create the caches with some "formatted" names. E.g. the net/core/sock.c creates the caches with names
("request_sock_%s", proto->name)
dccp need caches like
("%s_hc_rx_sock", ccid_ops->ccid_name)
and so on.
The proposal is to create the generic method for creating such a caches. The code is spread across sl[auo]b, so maybe its better to move it to mm/util.c
The question is: does it worth sending to mainline?
---
include/linux/slab.h +7 -0
@@ -54,7 +54,14 @@ int slab_is_available(void);struct kmem_cache *kmem_cache_create (const char *,size_t ,size_t ,unsigned long ,void (*)(struct kmem_cache *,void *)); + +#define KMEM_CACHE_NAME_MAX 128 +struct kmem_cache *kmem_cache_create_name (size_t ,size_t , +unsigned long ,void (*)(struct kmem_cache *,void *), +const char *fmt, ...) __attribute__ ((format (printf,5 ,6 ))); +void kmem_cache_destroy (struct kmem_cache *); +void kmem_cache_destroy_name (struct kmem_cache *);int kmem_cache_shrink (struct kmem_cache *);void kmem_cache_free (struct kmem_cache *,void *);unsigned int kmem_cache_size (struct kmem_cache *);
mm/slab.c +41 -0
53 lines not on this page · raw message
mm/slob.c +41 -0
53 lines not on this page · raw message
mm/slub.c +41 -0
53 lines not on this page · raw message
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>