diff options
author | Oleg Nesterov <oleg@redhat.com> | 2013-07-08 19:00:08 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-07-09 13:33:22 -0400 |
commit | 59d3132f8abdc18301898febf205d00db5f0458c (patch) | |
tree | f780fd6c6883edfbcdf2101e74941265d8e8a18b /mm/vmalloc.c | |
parent | 345606d42971fc4ed164fbabac118708d51b8e0a (diff) |
vfree: don't schedule free_work() if llist_add() returns false
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.
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/vmalloc.c')
-rw-r--r-- | mm/vmalloc.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/mm/vmalloc.c b/mm/vmalloc.c index 318c5007f226..a649186669a3 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c | |||
@@ -1477,7 +1477,6 @@ static void __vunmap(const void *addr, int deallocate_pages) | |||
1477 | * conventions for vfree() arch-depenedent would be a really bad idea) | 1477 | * conventions for vfree() arch-depenedent would be a really bad idea) |
1478 | * | 1478 | * |
1479 | * NOTE: assumes that the object at *addr has a size >= sizeof(llist_node) | 1479 | * NOTE: assumes that the object at *addr has a size >= sizeof(llist_node) |
1480 | * | ||
1481 | */ | 1480 | */ |
1482 | void vfree(const void *addr) | 1481 | void vfree(const void *addr) |
1483 | { | 1482 | { |
@@ -1489,8 +1488,8 @@ void vfree(const void *addr) | |||
1489 | return; | 1488 | return; |
1490 | if (unlikely(in_interrupt())) { | 1489 | if (unlikely(in_interrupt())) { |
1491 | struct vfree_deferred *p = &__get_cpu_var(vfree_deferred); | 1490 | struct vfree_deferred *p = &__get_cpu_var(vfree_deferred); |
1492 | llist_add((struct llist_node *)addr, &p->list); | 1491 | if (llist_add((struct llist_node *)addr, &p->list)) |
1493 | schedule_work(&p->wq); | 1492 | schedule_work(&p->wq); |
1494 | } else | 1493 | } else |
1495 | __vunmap(addr, 1); | 1494 | __vunmap(addr, 1); |
1496 | } | 1495 | } |