From: Byungchul Park Date: Wed, 6 Sep 2017 23:24:26 +0000 (-0700) Subject: mm/vmalloc.c: don't reinvent the wheel but use existing llist API X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=894e58c1475a03cd8260be7f28444cc298239432;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git mm/vmalloc.c: don't reinvent the wheel but use existing llist API 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 Cc: zijun_hu Cc: Michal Hocko Cc: Vlastimil Babka Cc: Joel Fernandes Cc: Andrey Ryabinin Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/mm/vmalloc.c b/mm/vmalloc.c index fa409c9092be..8a43db6284eb 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -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 ***/