Skip to content

Commit 80552f0

Browse files
Qian Caisuryasaimadhu
authored andcommitted
mm/slab: Remove store_stackinfo()
store_stackinfo() does not seem used in actual SLAB debugging. Potentially, it could be added to check_poison_obj() to provide more information but this seems like an overkill due to the declining popularity of SLAB, so just remove it instead. Signed-off-by: Qian Cai <cai@lca.pw> Signed-off-by: Borislav Petkov <bp@suse.de> Acked-by: Thomas Gleixner <tglx@linutronix.de> Acked-by: Vlastimil Babka <vbabka@suse.cz> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Andy Lutomirski <luto@amacapital.net> Cc: Christoph Lameter <cl@linux.com> Cc: David Rientjes <rientjes@google.com> Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com> Cc: Josh Poimboeuf <jpoimboe@redhat.com> Cc: linux-mm <linux-mm@kvack.org> Cc: Pekka Enberg <penberg@kernel.org> Cc: rientjes@google.com Cc: sean.j.christopherson@intel.com Link: https://lkml.kernel.org/r/20190416142258.18694-1-cai@lca.pw
1 parent dc4060a commit 80552f0

1 file changed

Lines changed: 6 additions & 42 deletions

File tree

‎mm/slab.c‎

Lines changed: 6 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1467,53 +1467,17 @@ static bool is_debug_pagealloc_cache(struct kmem_cache *cachep)
14671467
}
14681468

14691469
#ifdef CONFIG_DEBUG_PAGEALLOC
1470-
static void store_stackinfo(struct kmem_cache *cachep, unsigned long *addr,
1471-
unsigned long caller)
1472-
{
1473-
int size = cachep->object_size;
1474-
1475-
addr = (unsigned long *)&((char *)addr)[obj_offset(cachep)];
1476-
1477-
if (size < 5 * sizeof(unsigned long))
1478-
return;
1479-
1480-
*addr++ = 0x12345678;
1481-
*addr++ = caller;
1482-
*addr++ = smp_processor_id();
1483-
size -= 3 * sizeof(unsigned long);
1484-
{
1485-
unsigned long *sptr = &caller;
1486-
unsigned long svalue;
1487-
1488-
while (!kstack_end(sptr)) {
1489-
svalue = *sptr++;
1490-
if (kernel_text_address(svalue)) {
1491-
*addr++ = svalue;
1492-
size -= sizeof(unsigned long);
1493-
if (size <= sizeof(unsigned long))
1494-
break;
1495-
}
1496-
}
1497-
1498-
}
1499-
*addr++ = 0x87654321;
1500-
}
1501-
1502-
static void slab_kernel_map(struct kmem_cache *cachep, void *objp,
1503-
int map, unsigned long caller)
1470+
static void slab_kernel_map(struct kmem_cache *cachep, void *objp, int map)
15041471
{
15051472
if (!is_debug_pagealloc_cache(cachep))
15061473
return;
15071474

1508-
if (caller)
1509-
store_stackinfo(cachep, objp, caller);
1510-
15111475
kernel_map_pages(virt_to_page(objp), cachep->size / PAGE_SIZE, map);
15121476
}
15131477

15141478
#else
15151479
static inline void slab_kernel_map(struct kmem_cache *cachep, void *objp,
1516-
int map, unsigned long caller) {}
1480+
int map) {}
15171481

15181482
#endif
15191483

@@ -1661,7 +1625,7 @@ static void slab_destroy_debugcheck(struct kmem_cache *cachep,
16611625

16621626
if (cachep->flags & SLAB_POISON) {
16631627
check_poison_obj(cachep, objp);
1664-
slab_kernel_map(cachep, objp, 1, 0);
1628+
slab_kernel_map(cachep, objp, 1);
16651629
}
16661630
if (cachep->flags & SLAB_RED_ZONE) {
16671631
if (*dbg_redzone1(cachep, objp) != RED_INACTIVE)
@@ -2434,7 +2398,7 @@ static void cache_init_objs_debug(struct kmem_cache *cachep, struct page *page)
24342398
/* need to poison the objs? */
24352399
if (cachep->flags & SLAB_POISON) {
24362400
poison_obj(cachep, objp, POISON_FREE);
2437-
slab_kernel_map(cachep, objp, 0, 0);
2401+
slab_kernel_map(cachep, objp, 0);
24382402
}
24392403
}
24402404
#endif
@@ -2813,7 +2777,7 @@ static void *cache_free_debugcheck(struct kmem_cache *cachep, void *objp,
28132777

28142778
if (cachep->flags & SLAB_POISON) {
28152779
poison_obj(cachep, objp, POISON_FREE);
2816-
slab_kernel_map(cachep, objp, 0, caller);
2780+
slab_kernel_map(cachep, objp, 0);
28172781
}
28182782
return objp;
28192783
}
@@ -3077,7 +3041,7 @@ static void *cache_alloc_debugcheck_after(struct kmem_cache *cachep,
30773041
return objp;
30783042
if (cachep->flags & SLAB_POISON) {
30793043
check_poison_obj(cachep, objp);
3080-
slab_kernel_map(cachep, objp, 1, 0);
3044+
slab_kernel_map(cachep, objp, 1);
30813045
poison_obj(cachep, objp, POISON_INUSE);
30823046
}
30833047
if (cachep->flags & SLAB_STORE_USER)

0 commit comments

Comments
 (0)