aboutsummaryrefslogtreecommitdiff
path: root/mm/vmalloc.c
diff options
context:
space:
mode:
authorOleg Nesterov <oleg@redhat.com>2013-07-08 16:00:08 -0700
committerMoyster <oysterized@gmail.com>2019-05-02 21:06:10 +0200
commita558e665f41afd80680ecd704b37f381389c488f (patch)
tree6d39a782025fe8478862744112078563970646f6 /mm/vmalloc.c
parentb97c37901526d03a400714891946cb056a7993be (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> Change-Id: Ife3fdbd35dd7e4ba73ae6d59398642bbdc91e2b0 (cherry picked from commit b1d9d5877ac1da2670a768a15ff740a632f100c3)
Diffstat (limited to 'mm/vmalloc.c')
-rw-r--r--mm/vmalloc.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index 1870b1f7b..779998a9e 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -1514,7 +1514,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)
{
@@ -1526,8 +1525,8 @@ void vfree(const void *addr)
return;
if (unlikely(in_interrupt())) {
struct vfree_deferred *p = this_cpu_ptr(&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);
}