Skip to contentSkip to conversation

vfree: don't schedule free_work() if llist_add() returns F

PATCH New Oleg Nesterov 1 participant 1 message Jun 15, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 vfree: don't schedule free_work() if llist_add() returns F

vfree() only needs schedule_work(&p->wq) if p->list was empty, otherwise vfree_deferred->wq is already pending or it is running and didn't do llist_del_all() yet.

---
 mm/vmalloc.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)
mm/vmalloc.c +2 -3
index d365724..2b8f644 100644
@@ -1524,7 +1524,6 @@ static void __vunmap(const void *addr, int deallocate_pages)
  *	conventions for vfree() arch-depenedent would be a really bad idea)
  *
  *	NOTE: assumes that the object at *addr has a size >= sizeof(llist_node)
- *	
  */
 void vfree(const void *addr)
 {
@@ -1536,8 +1535,8 @@ void vfree(const void *addr)
 		return;
 	if (unlikely(in_interrupt())) {
 		struct vfree_deferred *p = &__get_cpu_var(vfree_deferred);
-		llist_add((struct llist_node *)addr, &p->list);
-		schedule_work(&p->wq);
+		if (llist_add((struct llist_node *)addr, &p->list))
+			schedule_work(&p->wq);
 	} else
 		__vunmap(addr, 1);
 }
Signature · 1 line
1.5.5.1