rcutorture: Move mem_dump_obj() tests into separate function
To make the purpose of the code more apparent, this commit moves the tests of mem_dump_obj() to a new rcu_torture_mem_dump_obj() function and calls it from rcu_torture_cleanup(). Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
This commit is contained in:
parent
3d78668e5b
commit
7ab2bd31df
|
@ -1868,48 +1868,49 @@ rcu_torture_stats(void *arg)
|
||||||
torture_shutdown_absorb("rcu_torture_stats");
|
torture_shutdown_absorb("rcu_torture_stats");
|
||||||
} while (!torture_must_stop());
|
} while (!torture_must_stop());
|
||||||
torture_kthread_stopping("rcu_torture_stats");
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Test mem_dump_obj() and friends. */
|
||||||
|
static void rcu_torture_mem_dump_obj(void)
|
||||||
|
{
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
rcu_torture_print_module_parms(struct rcu_torture_ops *cur_ops, const char *tag)
|
rcu_torture_print_module_parms(struct rcu_torture_ops *cur_ops, const char *tag)
|
||||||
{
|
{
|
||||||
|
@ -2825,6 +2826,8 @@ rcu_torture_cleanup(void)
|
||||||
if (cur_ops->cleanup != NULL)
|
if (cur_ops->cleanup != NULL)
|
||||||
cur_ops->cleanup();
|
cur_ops->cleanup();
|
||||||
|
|
||||||
|
rcu_torture_mem_dump_obj();
|
||||||
|
|
||||||
rcu_torture_stats_print(); /* -After- the stats thread is stopped! */
|
rcu_torture_stats_print(); /* -After- the stats thread is stopped! */
|
||||||
|
|
||||||
if (err_segs_recorded) {
|
if (err_segs_recorded) {
|
||||||
|
|
Loading…
Reference in New Issue