Commit 3cd018b4 authored by Matthew Wilcox's avatar Matthew Wilcox Committed by Linus Torvalds

mm/swap.c:put_pages_list(): reinitialise the page list

While free_unref_page_list() puts pages onto the CPU local LRU list, it
does not remove them from the list they were passed in on.  That makes
the list_head appear to be non-empty, and would lead to various
corruption problems if we didn't have an assertion that the list was
empty.

Reinitialise the list after calling free_unref_page_list() to avoid this
problem.

Link: https://lkml.kernel.org/r/YYp40A2lNrxaZji8@casper.infradead.org
Fixes: 988c69f1 ("mm: optimise put_pages_list()")
Signed-off-by: default avatarMatthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: default avatarSteve French <stfrench@microsoft.com>
Reported-by: default avatarNamjae Jeon <linkinjeon@kernel.org>
Tested-by: default avatarSteve French <stfrench@microsoft.com>
Tested-by: default avatarNamjae Jeon <linkinjeon@kernel.org>
Cc: Steve French <smfrench@gmail.com>
Cc: Hyeoncheol Lee <hyc.lee@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent a90af8f1
...@@ -156,6 +156,7 @@ void put_pages_list(struct list_head *pages) ...@@ -156,6 +156,7 @@ void put_pages_list(struct list_head *pages)
} }
free_unref_page_list(pages); free_unref_page_list(pages);
INIT_LIST_HEAD(pages);
} }
EXPORT_SYMBOL(put_pages_list); EXPORT_SYMBOL(put_pages_list);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment