On Tue, 8 Dec 2015, Jesper Dangaard Brouer wrote: > +/* Q: Howto handle this nicely? below includes are needed for alloc hooks > + * > + * e.g. mm/mempool.c and mm/slab_common.c does not include kmemcheck.h > + * including it here solves the probem, but should they include it > + * themselves? > + */ Including in mm/slab.h is enough. > +#ifdef CONFIG_SLUB Move this into slab_ksize? > +static inline size_t slab_ksize(const struct kmem_cache *s) > +{ > +#ifdef CONFIG_SLUB_DEBUG > + /* > + * Debugging requires use of the padding between object > + * and whatever may come after it. > + */ > + if (s->flags & (SLAB_RED_ZONE | SLAB_POISON)) > + return s->object_size; > +#endif > + /* > + * If we have the need to store the freelist pointer > + * back there or track user information then we can > + * only use the space before that information. > + */ > + if (s->flags & (SLAB_DESTROY_BY_RCU | SLAB_STORE_USER)) > + return s->inuse; > + /* > + * Else we can use all the padding etc for the allocation > + */ > + return s->size; > +} > +#else /* !CONFIG_SLUB */ Abnd drop the else branch? > +static inline size_t slab_ksize(const struct kmem_cache *s) > +{ > + return s->object_size; > +} > +#endif -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxx. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>