Skip to content

Commit

Permalink
mm/swap.c:put_pages_list(): reinitialise the page list
Browse files Browse the repository at this point in the history
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/[email protected]
Fixes: 988c69f ("mm: optimise put_pages_list()")
Signed-off-by: Matthew Wilcox (Oracle) <[email protected]>
Reviewed-by: Steve French <[email protected]>
Reported-by: Namjae Jeon <[email protected]>
Tested-by: Steve French <[email protected]>
Tested-by: Namjae Jeon <[email protected]>
Cc: Steve French <[email protected]>
Cc: Hyeoncheol Lee <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Matthew Wilcox authored and torvalds committed Nov 20, 2021
1 parent a90af8f commit 3cd018b
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions mm/swap.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ void put_pages_list(struct list_head *pages)
}

free_unref_page_list(pages);
INIT_LIST_HEAD(pages);
}
EXPORT_SYMBOL(put_pages_list);

Expand Down

0 comments on commit 3cd018b

Please sign in to comment.