Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4d704c30 authored by Vinayak Menon's avatar Vinayak Menon
Browse files

mm: do not activate swap write failed pages



Sometime back a piece of code was added to activate
pages in pageout which failed to writeback. This was
done for the case of failed write to zram, with the
intention of reducing further zram writes. But this
does not make much sense because there can anyway be
other pages which the reclaim path can pick to swap
out.
And this particular logic has a problem. When a write
fails, the page is unlocked. Its locked again before
activating the page, but the page which is now in
swapcache can be brought back with its original mapping
through a fault, which can happen during this period.
This can result in random bugs, for e.g. when shrink_page_list
try to do try_to_free_swap. Here is one such case.
In this case PageSwapCache was cleared by the fault path.

"
zram: Error allocating memory for compressed page: 91433, size=4096
Write-error on swap-device (254:0:731464)
page:de866e80 count:3 mapcount:1 mapping:d5368941 index:0xb2ce5
flags: 0x80018(uptodate|dirty|swapbacked)
page dumped because: VM_BUG_ON_PAGE(!PageSwapCache(page))
"

CRs-Fixed: 988207
Change-Id: I26738d0f8dd3e2dfdb24c25edac24a7d968eeba0
Signed-off-by: default avatarVinayak Menon <vinmenon@codeaurora.org>
parent 53d1dd96
Loading
Loading
Loading
Loading
+0 −12
Original line number Diff line number Diff line
@@ -582,18 +582,6 @@ static pageout_t pageout(struct page *page, struct address_space *mapping,
		if (!PageWriteback(page)) {
			/* synchronous write or broken a_ops? */
			ClearPageReclaim(page);
			if (PageError(page) && PageSwapCache(page)) {
				ClearPageError(page);
				/*
				 * We lock the page here because it is required
				 * to free the swp space later in
				 * shrink_page_list. But the page may be
				 * unclocked by functions like
				 * handle_write_error.
				 */
				__set_page_locked(page);
				return PAGE_ACTIVATE;
			}
		}
		trace_mm_vmscan_writepage(page, trace_reclaim_flags(page));
		inc_zone_page_state(page, NR_VMSCAN_WRITE);