Re: [PATCH 4/4] slab: Use for_each_kmem_cache_node function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Additional use cases for kmem_cache_node:



Subject: slab: use for_each_kmem_cache_node instead of for_each_online_node

Some use cases. There could be more work done to clean this up and use
for_each_kmem_cache_node in more places but the structure of some of these
functions may have to be changed a bit.

Signed-off-by: Christoph Lameter <cl@xxxxxxxxx>

Index: linux/mm/slab.c
===================================================================
--- linux.orig/mm/slab.c	2014-05-30 13:23:24.879105040 -0500
+++ linux/mm/slab.c	2014-06-02 10:50:26.631319986 -0500
@@ -1632,14 +1632,10 @@ slab_out_of_memory(struct kmem_cache *ca
 	printk(KERN_WARNING "  cache: %s, object size: %d, order: %d\n",
 		cachep->name, cachep->size, cachep->gfporder);

-	for_each_online_node(node) {
+	for_each_kmem_cache_node(cachep, node, n) {
 		unsigned long active_objs = 0, num_objs = 0, free_objects = 0;
 		unsigned long active_slabs = 0, num_slabs = 0;

-		n = cachep->node[node];
-		if (!n)
-			continue;
-
 		spin_lock_irqsave(&n->list_lock, flags);
 		list_for_each_entry(page, &n->slabs_full, lru) {
 			active_objs += cachep->num;
@@ -4040,10 +4036,7 @@ void get_slabinfo(struct kmem_cache *cac

 	active_objs = 0;
 	num_slabs = 0;
-	for_each_online_node(node) {
-		n = get_node(cachep, node);
-		if (!n)
-			continue;
+	for_each_kmem_cache_node(cachep, node, n) {

 		check_irq_on();
 		spin_lock_irq(&n->list_lock);
@@ -4277,10 +4270,7 @@ static int leaks_show(struct seq_file *m

 	x[1] = 0;

-	for_each_online_node(node) {
-		n = get_node(cachep, node);
-		if (!n)
-			continue;
+	for_each_kmem_cache_node(cachep, node, n) {

 		check_irq_on();
 		spin_lock_irq(&n->list_lock);

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]