linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] shmem: fix pageflags after swapping DMA32 object
@ 2016-11-07  4:08 Hugh Dickins
  2016-11-07 11:29 ` Kirill A. Shutemov
  0 siblings, 1 reply; 2+ messages in thread
From: Hugh Dickins @ 2016-11-07  4:08 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Kirill A. Shutemov, linux-kernel, linux-mm, intel-gfx

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: stable@vger.kernel.org # v4.8
Signed-off-by: Hugh Dickins <hughd@google.com>
---

 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);
 	flush_dcache_page(newpage);
 
+	__SetPageLocked(newpage);
+	__SetPageSwapBacked(newpage);
 	SetPageUptodate(newpage);
 	set_page_private(newpage, swap_index);
 	SetPageSwapCache(newpage);

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] shmem: fix pageflags after swapping DMA32 object
  2016-11-07  4:08 [PATCH] shmem: fix pageflags after swapping DMA32 object Hugh Dickins
@ 2016-11-07 11:29 ` Kirill A. Shutemov
  0 siblings, 0 replies; 2+ messages in thread
From: Kirill A. Shutemov @ 2016-11-07 11:29 UTC (permalink / raw)
  To: Hugh Dickins
  Cc: Andrew Morton, Kirill A. Shutemov, linux-kernel, linux-mm, intel-gfx

On Sun, Nov 06, 2016 at 08:08:29PM -0800, Hugh Dickins wrote:
> 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: stable@vger.kernel.org # v4.8
> Signed-off-by: Hugh Dickins <hughd@google.com>

Sorry for that.

Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>

-- 
 Kirill A. Shutemov

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-11-07 11:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-07  4:08 [PATCH] shmem: fix pageflags after swapping DMA32 object Hugh Dickins
2016-11-07 11:29 ` Kirill A. Shutemov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).