mm/zswap: bugfix: memory leak when re-swapon
Subsystems (3)
PATCH v3 1/3 mm/zswap: bugfix: memory leak when re-swapon
zswap_tree is not freed when swapoff, and it got re-kmalloc in swapon, so memory-leak occurs.
Modify: free memory of zswap_tree in zswap_frontswap_invalidate_area().
Signed-off-by Weijie Yang <[email protected]>
Reviewed-by Bob Liu <[email protected]>
Cc Minchan Kim <[email protected]>
Acked-by Seth Jennings <[email protected]>
--- mm/zswap.c | 4 ++++ 1 file changed, 4 insertions(+)
mm/zswap.c +4 -0
@@ -816,6 +816,10 @@ static void zswap_frontswap_invalidate_area(unsigned type) } tree->rbroot =RB_ROOT ;spin_unlock (&tree->lock); + +zbud_destroy_pool (tree->pool); +kfree (tree); + zswap_trees[type] =NULL ; }static struct zbud_ops zswap_zbud_ops = {
Signature · 1 line
1.7.10.4
Quoted 10 lines · Weijie Yang
zswap_treeis not freed when swapoff, and it got re-kmalloc in swapon, so memory-leak occurs.Modify: free memory of
zswap_treeinzswap_frontswap_invalidate_area().Signed-off-by Weijie Yang <[email protected]>Reviewed-by Bob Liu <[email protected]>Cc Minchan Kim <[email protected]>Acked-by Seth Jennings <[email protected]>
Reviewed-by Minchan Kim <[email protected]>
Signature · 8 lines
Kind regards, Minchan Kim -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>