mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-23 20:24:12 +08:00
rcutorture: Add crude tests for mem_dump_obj()
This commit adds a few crude tests for mem_dump_obj() to rcutorture runs. Just to prevent bitrot, you understand! Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
This commit is contained in:
parent
5bb1bb353c
commit
0d3dd2c8ea
@ -1861,6 +1861,45 @@ rcu_torture_stats(void *arg)
|
||||
torture_shutdown_absorb("rcu_torture_stats");
|
||||
} while (!torture_must_stop());
|
||||
torture_kthread_stopping("rcu_torture_stats");
|
||||
|
||||
{
|
||||
struct rcu_head *rhp;
|
||||
struct kmem_cache *kcp;
|
||||
static int z;
|
||||
|
||||
kcp = kmem_cache_create("rcuscale", 136, 8, SLAB_STORE_USER, NULL);
|
||||
rhp = kmem_cache_alloc(kcp, GFP_KERNEL);
|
||||
pr_alert("mem_dump_obj() slab test: rcu_torture_stats = %px, &rhp = %px, rhp = %px, &z = %px\n", stats_task, &rhp, rhp, &z);
|
||||
pr_alert("mem_dump_obj(ZERO_SIZE_PTR):");
|
||||
mem_dump_obj(ZERO_SIZE_PTR);
|
||||
pr_alert("mem_dump_obj(NULL):");
|
||||
mem_dump_obj(NULL);
|
||||
pr_alert("mem_dump_obj(%px):", &rhp);
|
||||
mem_dump_obj(&rhp);
|
||||
pr_alert("mem_dump_obj(%px):", rhp);
|
||||
mem_dump_obj(rhp);
|
||||
pr_alert("mem_dump_obj(%px):", &rhp->func);
|
||||
mem_dump_obj(&rhp->func);
|
||||
pr_alert("mem_dump_obj(%px):", &z);
|
||||
mem_dump_obj(&z);
|
||||
kmem_cache_free(kcp, rhp);
|
||||
kmem_cache_destroy(kcp);
|
||||
rhp = kmalloc(sizeof(*rhp), GFP_KERNEL);
|
||||
pr_alert("mem_dump_obj() kmalloc test: rcu_torture_stats = %px, &rhp = %px, rhp = %px\n", stats_task, &rhp, rhp);
|
||||
pr_alert("mem_dump_obj(kmalloc %px):", rhp);
|
||||
mem_dump_obj(rhp);
|
||||
pr_alert("mem_dump_obj(kmalloc %px):", &rhp->func);
|
||||
mem_dump_obj(&rhp->func);
|
||||
kfree(rhp);
|
||||
rhp = vmalloc(4096);
|
||||
pr_alert("mem_dump_obj() vmalloc test: rcu_torture_stats = %px, &rhp = %px, rhp = %px\n", stats_task, &rhp, rhp);
|
||||
pr_alert("mem_dump_obj(vmalloc %px):", rhp);
|
||||
mem_dump_obj(rhp);
|
||||
pr_alert("mem_dump_obj(vmalloc %px):", &rhp->func);
|
||||
mem_dump_obj(&rhp->func);
|
||||
vfree(rhp);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -545,6 +545,7 @@ bool kmem_valid_obj(void *object)
|
||||
page = virt_to_head_page(object);
|
||||
return PageSlab(page);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(kmem_valid_obj);
|
||||
|
||||
/**
|
||||
* kmem_dump_obj - Print available slab provenance information
|
||||
@ -601,6 +602,7 @@ void kmem_dump_obj(void *object)
|
||||
pr_info(" %pS\n", kp.kp_stack[i]);
|
||||
}
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(kmem_dump_obj);
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_SLOB
|
||||
|
Loading…
Reference in New Issue
Block a user