[PATCH mmotm 2/5] huge tmpfs: fix mlocked meminfo track huge unhuge mlocks fix
From: Hugh Dickins
Date: Sat Apr 16 2016 - 19:29:57 EST
Please add this fix after
huge-tmpfs-fix-mlocked-meminfo-track-huge-unhuge-mlocks.patch
for later merging into it. I expect this to fix a build problem found
by robot on an x86_64 randconfig. I was not able to reproduce the error,
but I'm growing to realize that different optimizers behave differently.
Reported-by: kbuild test robot <fengguang.wu@xxxxxxxxx>
Signed-off-by: Hugh Dickins <hughd@xxxxxxxxxx>
---
mm/rmap.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -1445,8 +1445,12 @@ static int try_to_unmap_one(struct page
*/
if (!(flags & TTU_IGNORE_MLOCK)) {
if (vma->vm_flags & VM_LOCKED) {
+ int nr_pages = 1;
+
+ if (IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE) && !pte)
+ nr_pages = HPAGE_PMD_NR;
/* Holding pte lock, we do *not* need mmap_sem here */
- mlock_vma_pages(page, pte ? 1 : HPAGE_PMD_NR);
+ mlock_vma_pages(page, nr_pages);
ret = SWAP_MLOCK;
goto out_unmap;
}