]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/3.3.4/mm-fix-s390-bug-by-__set_page_dirty_no_writeback-on-swap.patch
4.9-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 3.3.4 / mm-fix-s390-bug-by-__set_page_dirty_no_writeback-on-swap.patch
CommitLineData
59cd8bf3
GKH
1From aca50bd3b4c4bb5528a1878158ba7abce41de534 Mon Sep 17 00:00:00 2001
2From: Hugh Dickins <hughd@google.com>
3Date: Mon, 23 Apr 2012 11:14:50 -0700
4Subject: mm: fix s390 BUG by __set_page_dirty_no_writeback on swap
5
6From: Hugh Dickins <hughd@google.com>
7
8commit aca50bd3b4c4bb5528a1878158ba7abce41de534 upstream.
9
10Mel reports a BUG_ON(slot == NULL) in radix_tree_tag_set() on s390
113.0.13: called from __set_page_dirty_nobuffers() when page_remove_rmap()
12tries to transfer dirty flag from s390 storage key to struct page and
13radix_tree.
14
15That would be because of reclaim's shrink_page_list() calling
16add_to_swap() on this page at the same time: first PageSwapCache is set
17(causing page_mapping(page) to appear as &swapper_space), then
18page->private set, then tree_lock taken, then page inserted into
19radix_tree - so there's an interval before taking the lock when the
20radix_tree slot is empty.
21
22We could fix this by moving __add_to_swap_cache()'s spin_lock_irq up
23before the SetPageSwapCache. But a better fix is simply to do what's
24five years overdue: Ken Chen introduced __set_page_dirty_no_writeback()
25(if !PageDirty TestSetPageDirty) for tmpfs to skip all the radix_tree
26overhead, and swap is just the same - it ignores the radix_tree tag, and
27does not participate in dirty page accounting, so should be using
28__set_page_dirty_no_writeback() too.
29
30s390 testing now confirms that this does indeed fix the problem.
31
32Reported-by: Mel Gorman <mgorman@suse.de>
33Signed-off-by: Hugh Dickins <hughd@google.com>
34Acked-by: Mel Gorman <mgorman@suse.de>
35Cc: Andrew Morton <akpm@linux-foundation.org>
36Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
37Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
38Cc: Rik van Riel <riel@redhat.com>
39Cc: Ken Chen <kenchen@google.com>
40Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
41Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
42
43---
44 mm/swap_state.c | 2 +-
45 1 file changed, 1 insertion(+), 1 deletion(-)
46
47--- a/mm/swap_state.c
48+++ b/mm/swap_state.c
49@@ -26,7 +26,7 @@
50 */
51 static const struct address_space_operations swap_aops = {
52 .writepage = swap_writepage,
53- .set_page_dirty = __set_page_dirty_nobuffers,
54+ .set_page_dirty = __set_page_dirty_no_writeback,
55 .migratepage = migrate_page,
56 };
57