[lkml]   [2016]   [Nov]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[PATCH] shmem: fix pageflags after swapping DMA32 object
If shmem_alloc_page() does not set PageLocked and PageSwapBacked, then
shmem_replace_page() needs to do so for itself. Without this, it puts
newpage on the wrong lru, re-unlocks the unlocked newpage, and system
descends into "Bad page" reports and freeze; or if CONFIG_DEBUG_VM=y,
it hits an earlier VM_BUG_ON_PAGE(!PageLocked), depending on config.

But shmem_replace_page() is not a common path: it's only called when
swapin (or swapoff) finds the page was already read into an unsuitable
zone: usually all zones are suitable, but gem objects for a few drm
devices (gma500, omapdrm, crestline, broadwater) require zone DMA32
if there's more than 4GB of ram.

Fixes: 800d8c63b2e9 ("shmem: add huge pages support")
Cc: # v4.8
Signed-off-by: Hugh Dickins <>

mm/shmem.c | 2 ++
1 file changed, 2 insertions(+)

--- 4.9-rc4/mm/shmem.c 2016-10-15 12:52:13.157533478 -0700
+++ linux/mm/shmem.c 2016-11-06 12:45:49.626193769 -0800
@@ -1483,6 +1483,8 @@ static int shmem_replace_page(struct pag
copy_highpage(newpage, oldpage);

+ __SetPageLocked(newpage);
+ __SetPageSwapBacked(newpage);
set_page_private(newpage, swap_index);
 \ /
  Last update: 2016-11-07 05:08    [W:0.027 / U:1.552 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site