On Thu, Dec 10, 2020 at 07:33:59PM -0800, Paul E. McKenney wrote: > On Fri, Dec 11, 2020 at 11:22:10AM +0900, Joonsoo Kim wrote: > > On Thu, Dec 10, 2020 at 05:19:58PM -0800, paulmck@xxxxxxxxxx wrote: > > > From: "Paul E. McKenney" <paulmck@xxxxxxxxxx> [ . . . ] > > We can get some infos even if CONFIG_SLUB_DEBUG isn't defined. > > Please move them out. > > I guess since I worry about CONFIG_MMU=n it only makes sense to also > worry about CONFIG_SLUB_DEBUG=n. Fix update. Like this? (Patch on top of the series, to be folded into the first one.) Thanx, Paul ------------------------------------------------------------------------ diff --git a/mm/slub.c b/mm/slub.c index 0459d2a..abf43f0 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -3920,21 +3920,24 @@ int __kmem_cache_shutdown(struct kmem_cache *s) void kmem_obj_info(struct kmem_obj_info *kpp, void *object, struct page *page) { -#ifdef CONFIG_SLUB_DEBUG void *base; - int i; + int __maybe_unused i; unsigned int objnr; void *objp; void *objp0; struct kmem_cache *s = page->slab_cache; - struct track *trackp; + struct track __maybe_unused *trackp; kpp->kp_ptr = object; kpp->kp_page = page; kpp->kp_slab_cache = s; base = page_address(page); objp0 = kasan_reset_tag(object); +#ifdef CONFIG_SLUB_DEBUG objp = restore_red_left(s, objp0); +#else + objp = objp0; +#endif objnr = obj_to_index(s, page, objp); kpp->kp_data_offset = (unsigned long)((char *)objp0 - (char *)objp); objp = base + s->size * objnr; @@ -3942,6 +3945,7 @@ void kmem_obj_info(struct kmem_obj_info *kpp, void *object, struct page *page) if (WARN_ON_ONCE(objp < base || objp >= base + page->objects * s->size || (objp - base) % s->size) || !(s->flags & SLAB_STORE_USER)) return; +#ifdef CONFIG_SLUB_DEBUG trackp = get_track(s, objp, TRACK_ALLOC); kpp->kp_ret = (void *)trackp->addr; #ifdef CONFIG_STACKTRACE