Skip to contentSkip to conversation

mm/slab: use list_move instead of list_del/list_add

PATCH New [email protected] 1 participant 1 message Jul 26, 2016 Memory management

lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

PATCH 25/126 mm/slab: use list_move instead of list_del/list_add

From: Wei Yongjun <[email protected]>
Subject: mm/slab: use list_move instead of list_del/list_add

Using list_move() instead of list_del() + list_add() to avoid needlessly poisoning the next and prev values.

---

 mm/slab.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
mm/slab.c renamed from mm/slab.c~mm-slab-use-list_move-instead-of-list_del-list_add +1 -2
diff -puN mm/slab.c~mm-slab-use-list_move-instead-of-list_del-list_add mm/slab.c
@@ -3452,8 +3452,7 @@ static void free_block(struct kmem_cache
 		n->free_objects -= cachep->num;
 
 		page = list_last_entry(&n->slabs_free, struct page, lru);
-		list_del(&page->lru);
-		list_add(&page->lru, list);
+		list_move(&page->lru, list);
 	}
 }
 

_