History

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!

Paul E. McKenney committed 5 years ago

Commit 0d3dd2c1 parent 5bb1bb33 files · +42 −0Browse files

Showing the changes to kernel (1 of 3 files). Show all

Unified · Split

kernel/rcu/rcutorture.c+39−0
@@ -1861,6 +1861,45 @@ rcu_torture_stats(void *arg) · 1860 unmodified lines
18611861 torture_shutdown_absorb("rcu_torture_stats");
18621862 } while (!torture_must_stop());
18631863 torture_kthread_stopping("rcu_torture_stats");
1864+
1865+ {
1866+ struct rcu_head *rhp;
1867+ struct kmem_cache *kcp;
1868+ static int z;
1869+
1870+ kcp = kmem_cache_create("rcuscale", 136, 8, SLAB_STORE_USER, NULL);
1871+ rhp = kmem_cache_alloc(kcp, GFP_KERNEL);
1872+ pr_alert("mem_dump_obj() slab test: rcu_torture_stats = %px, &rhp = %px, rhp = %px, &z = %px\n", stats_task, &rhp, rhp, &z);
1873+ pr_alert("mem_dump_obj(ZERO_SIZE_PTR):");
1874+ mem_dump_obj(ZERO_SIZE_PTR);
1875+ pr_alert("mem_dump_obj(NULL):");
1876+ mem_dump_obj(NULL);
1877+ pr_alert("mem_dump_obj(%px):", &rhp);
1878+ mem_dump_obj(&rhp);
1879+ pr_alert("mem_dump_obj(%px):", rhp);
1880+ mem_dump_obj(rhp);
1881+ pr_alert("mem_dump_obj(%px):", &rhp->func);
1882+ mem_dump_obj(&rhp->func);
1883+ pr_alert("mem_dump_obj(%px):", &z);
1884+ mem_dump_obj(&z);
1885+ kmem_cache_free(kcp, rhp);
1886+ kmem_cache_destroy(kcp);
1887+ rhp = kmalloc(sizeof(*rhp), GFP_KERNEL);
1888+ pr_alert("mem_dump_obj() kmalloc test: rcu_torture_stats = %px, &rhp = %px, rhp = %px\n", stats_task, &rhp, rhp);
1889+ pr_alert("mem_dump_obj(kmalloc %px):", rhp);
1890+ mem_dump_obj(rhp);
1891+ pr_alert("mem_dump_obj(kmalloc %px):", &rhp->func);
1892+ mem_dump_obj(&rhp->func);
1893+ kfree(rhp);
1894+ rhp = vmalloc(4096);
1895+ pr_alert("mem_dump_obj() vmalloc test: rcu_torture_stats = %px, &rhp = %px, rhp = %px\n", stats_task, &rhp, rhp);
1896+ pr_alert("mem_dump_obj(vmalloc %px):", rhp);
1897+ mem_dump_obj(rhp);
1898+ pr_alert("mem_dump_obj(vmalloc %px):", &rhp->func);
1899+ mem_dump_obj(&rhp->func);
1900+ vfree(rhp);
1901+ }
1902+
18641903 return 0;
18651904 }
18661905

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t