To catch the error in updating the swap cache shadow entries or their count.

Signed-off-by: "Huang, Ying" <[email protected]>
Cc: Minchan Kim <[email protected]>
Cc: Joonsoo Kim <[email protected]>,
Cc: Johannes Weiner <[email protected]>,
Cc: Vlastimil Babka <[email protected]>, Hugh Dickins <[email protected]>,
Cc: Mel Gorman <[email protected]>,
Cc: Michal Hocko <[email protected]>,
Cc: Dan Williams <[email protected]>,
Cc: Christoph Hellwig <[email protected]>, Ilya Dryomov <[email protected]>,
---
 mm/swap_state.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/mm/swap_state.c b/mm/swap_state.c
index d0d417efeecc..240a4f97594a 100644
--- a/mm/swap_state.c
+++ b/mm/swap_state.c
@@ -703,7 +703,12 @@ int init_swap_address_space(unsigned int type, unsigned 
long nr_pages)
 
 void exit_swap_address_space(unsigned int type)
 {
-       kvfree(swapper_spaces[type]);
+       int i;
+       struct address_space *spaces = swapper_spaces[type];
+
+       for (i = 0; i < nr_swapper_spaces[type]; i++)
+               VM_BUG_ON(spaces[i].nrexceptional);
+       kvfree(spaces);
        nr_swapper_spaces[type] = 0;
        swapper_spaces[type] = NULL;
 }
-- 
2.29.2

Reply via email to