]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
shmem: fix pageflags after swapping DMA32 object
authorHugh Dickins <hughd@google.com>
Thu, 10 Nov 2016 18:46:11 +0000 (10:46 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 18 Nov 2016 09:51:44 +0000 (10:51 +0100)
commitc87739e5d029a61ef1bbaccd90d07194459f9640
tree3cbddf777dd4f2ec0c2d6f33cec65cfc11b18438
parent5b5243b606ec0de2988d32207a537841d4ead721
shmem: fix pageflags after swapping DMA32 object

commit 9956edf37e65e93fbb76dcff1236dff2323d306a upstream.

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")
Link: http://lkml.kernel.org/r/alpine.LSU.2.11.1611062003510.11253@eggly.anvils
Signed-off-by: Hugh Dickins <hughd@google.com>
Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
mm/shmem.c