Re: [PATCH 2/2] mm, thp: clear PG_mlocked when last mapping gone

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 12/29/2015 09:46 PM, Kirill A. Shutemov wrote:
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@xxxxxxxxxx

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.

Git blame actually quickly points to commit e6c509f854550 which explains it :)


The patch can be folded into
  "thp: allow mlocked THP again"

Signed-off-by: Kirill A. Shutemov <kirill.shutemov@xxxxxxxxxxxxxxx>

Ack.

Reported-by: Sasha Levin <sasha.levin@xxxxxxxxxx>
---
  mm/rmap.c | 3 +++
  1 file changed, 3 insertions(+)

diff --git a/mm/rmap.c b/mm/rmap.c
index 384516fb7495..68af2e32f7ed 100644
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -1356,6 +1356,9 @@ static void page_remove_anon_compound_rmap(struct page *page)
  		nr = HPAGE_PMD_NR;
  	}

+	if (unlikely(PageMlocked(page)))
+		clear_page_mlock(page);
+
  	if (nr) {
  		__mod_zone_page_state(page_zone(page), NR_ANON_PAGES, -nr);
  		deferred_split_huge_page(page);


--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]