Skip to content

Commit 8beb2d5

Browse files
kirylsfrothwell
authored andcommitted
mm, thp: clear PG_mlocked when last mapping gone
I missed clear_page_mlock() in page_remove_anon_compound_rmap(). It usually shouldn't cause any problems since we munlock pages explicitly, but in conjunction with missed munlock in __oom_reap_vmas() it causes problems: http://lkml.kernel.org/r/5661FBB6.6050307@oracle.com Let's put it in place an mirror behaviour for small pages. NOTE: I'm not entirely sure why we ever need clear_page_mlock() in page_remove_rmap() codepath. It looks redundant to me as we munlock pages anyway. But this is out of scope of the patch. The patch can be folded into "thp: allow mlocked THP again" Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Reported-by: Sasha Levin <sasha.levin@oracle.com> Tested-by: Sasha Levin <sasha.levin@oracle.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
1 parent d43590a commit 8beb2d5

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

mm/rmap.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1282,6 +1282,9 @@ static void page_remove_anon_compound_rmap(struct page *page)
12821282
nr = HPAGE_PMD_NR;
12831283
}
12841284

1285+
if (unlikely(PageMlocked(page)))
1286+
clear_page_mlock(page);
1287+
12851288
if (nr) {
12861289
__mod_zone_page_state(page_zone(page), NR_ANON_PAGES, -nr);
12871290
deferred_split_huge_page(page);

0 commit comments

Comments
 (0)