--- zzzz-none-000/linux-4.4.271/include/linux/slab.h 2021-06-03 06:22:09.000000000 +0000 +++ dakota-7530ac-750/linux-4.4.271/include/linux/slab.h 2023-01-11 09:25:43.000000000 +0000 @@ -26,7 +26,18 @@ #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_STORE_USER_LITE 0x00020000UL /* AVM: need for slab_allocator usage */ #define SLAB_PANIC 0x00040000UL /* Panic if kmem_cache_create() fails */ +#define SLAB_PANIC_CORRUPTION 0x00080000UL /* Panic if alloc/free consistency check fails */ + +#if defined(CONFIG_DEBUG_SLAB_AVM_LITE) +#define SLAB_STORE_USER_AND_TIME 0x04000000UL /* DEBUG_SLAB_AVM_LITE: Store the last owner for oom-analyzing */ +#define SLAB_POISON_WRITE_AFTER_FREE 0x08000000UL /* DEBUG_SLAB_AVM_LITE: if poison on check write after free */ + +#if defined(CONFIG_DEBUG_SLAB) +#error conflict DEBUG_SLAB versus DEBUG_SLAB_AVM_LITE +#endif +#endif/*--- #if defined(CONFIG_DEBUG_SLAB_AVM_LITE) ---*/ /* * SLAB_DESTROY_BY_RCU - **WARNING** READ THIS! * @@ -182,15 +193,15 @@ #ifdef CONFIG_SLAB /* * The largest kmalloc size supported by the SLAB allocators is - * 32 megabyte (2^25) or the maximum allocatable page order if that is - * less than 32 MB. + * 1 megabyte (2^20) or the maximum allocatable page order if that is + * less than 1 MB. * * WARNING: Its not easy to increase this value since the allocators have * to do various tricks to work around compiler limitations in order to * ensure proper constant folding. */ -#define KMALLOC_SHIFT_HIGH ((MAX_ORDER + PAGE_SHIFT - 1) <= 25 ? \ - (MAX_ORDER + PAGE_SHIFT - 1) : 25) +#define KMALLOC_SHIFT_HIGH ((MAX_ORDER + PAGE_SHIFT - 1) <= 20 ? \ + (MAX_ORDER + PAGE_SHIFT - 1) : 20) #define KMALLOC_SHIFT_MAX KMALLOC_SHIFT_HIGH #ifndef KMALLOC_SHIFT_LOW #define KMALLOC_SHIFT_LOW 5 @@ -616,4 +627,11 @@ unsigned int kmem_cache_size(struct kmem_cache *s); void __init kmem_cache_init_late(void); +#if defined(CONFIG_SLUB_AVM_ALLOC_LIST) +void kmem_cache_list_all_objects(struct kmem_cache *s, void *ref, + int (*object_pointer)(void *ref, void *p)); + +unsigned int kmem_cache_active_objects(struct kmem_cache *s); +#endif + #endif /* _LINUX_SLAB_H */