On Wed, 26 Oct 2016, Thomas Garnier wrote:

> Okay, I think for SLAB we can allow everything except the two flags
> mentioned here.

No no no. Just allow the flags already defined in include/linux/slab.h
that can be specd by subsystems when they call into the slab allocators.

> Should I deny certain flags for SLUB? I can allow everything for now.

All allocator should just allow flags defined in include/linux/slab.h be
passed to kmem_cache_create(). That is the API that all allocators need to 
support.
If someone wants to add new flags then we need to make sure that all
allocators can handle it.


The flags are (from include/linux/slab.h)
/*
 * Flags to pass to kmem_cache_create().
 */
#define SLAB_CONSISTENCY_CHECKS 0x00000100UL    /* DEBUG: Perform (expensive) 
checks on alloc/free */
#define SLAB_RED_ZONE           0x00000400UL    /* DEBUG: Red zone objs in a 
cache */
#define SLAB_POISON             0x00000800UL    /* DEBUG: Poison objects */
#define SLAB_HWCACHE_ALIGN      0x00002000UL    /* Align objs on cache lines */
#define SLAB_CACHE_DMA          0x00004000UL    /* Use GFP_DMA memory */
#define SLAB_STORE_USER         0x00010000UL    /* DEBUG: Store the last owner 
for bug hunting */
#define SLAB_PANIC              0x00040000UL    /* Panic if kmem_cache_create() 
fails */
#define SLAB_DESTROY_BY_RCU     0x00080000UL    /* Defer freeing slabs to RCU */
#define SLAB_MEM_SPREAD         0x00100000UL    /* Spread some memory over 
cpuset */
#define SLAB_TRACE              0x00200000UL    /* Trace allocations and frees 
*/
#define SLAB_DEBUG_OBJECTS      0x00400000UL
#define SLAB_NOLEAKTRACE        0x00800000UL    /* Avoid kmemleak tracing
#define SLAB_NOTRACK            0x01000000UL
#define SLAB_FAILSLAB           0x02000000UL    /* Fault injection mark */
#define SLAB_ACCOUNT            0x04000000UL    /* Account to memcg */
#define SLAB_KASAN              0x08000000UL
#define SLAB_RECLAIM_ACCOUNT    0x00020000UL            /* Objects are 
reclaimable */

Reply via email to