mm/vmalloc.c: don't reinvent the wheel but use existing llist API
authorByungchul Park <byungchul.park@lge.com>
Wed, 6 Sep 2017 23:24:26 +0000 (16:24 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 7 Sep 2017 00:27:29 +0000 (17:27 -0700)
Although llist provides proper APIs, they are not used.  Make them used.

Link: http://lkml.kernel.org/r/1502095374-16112-1-git-send-email-byungchul.park@lge.com
Signed-off-by: Byungchul Park <byungchul.park@lge.com>
Cc: zijun_hu <zijun_hu@htc.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Joel Fernandes <joelaf@google.com>
Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/vmalloc.c

index fa409c9092be0aac5a11d2436cb9b8e1d272f656..8a43db6284ebcb9c40dfc3532d454c783ea61412 100644 (file)
@@ -49,12 +49,10 @@ static void __vunmap(const void *, int);
 static void free_work(struct work_struct *w)
 {
        struct vfree_deferred *p = container_of(w, struct vfree_deferred, wq);
-       struct llist_node *llnode = llist_del_all(&p->list);
-       while (llnode) {
-               void *p = llnode;
-               llnode = llist_next(llnode);
-               __vunmap(p, 1);
-       }
+       struct llist_node *t, *llnode;
+
+       llist_for_each_safe(llnode, t, llist_del_all(&p->list))
+               __vunmap((void *)llnode, 1);
 }
 
 /*** Page table manipulation functions ***/