From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wi0-f180.google.com (mail-wi0-f180.google.com [209.85.212.180]) by kanga.kvack.org (Postfix) with ESMTP id 80CAA6B0070 for ; Wed, 27 May 2015 19:54:02 -0400 (EDT) Received: by wicmx19 with SMTP id mx19so128309866wic.0 for ; Wed, 27 May 2015 16:54:02 -0700 (PDT) Received: from mail-wi0-x22e.google.com (mail-wi0-x22e.google.com. [2a00:1450:400c:c05::22e]) by mx.google.com with ESMTPS id cx3si1521748wib.115.2015.05.27.16.54.00 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 27 May 2015 16:54:01 -0700 (PDT) Received: by wifw1 with SMTP id w1so41446132wif.0 for ; Wed, 27 May 2015 16:54:00 -0700 (PDT) MIME-Version: 1.0 Date: Wed, 27 May 2015 16:54:00 -0700 Message-ID: Subject: [PATCH] mm/migrate: Avoid migrate mmaped compound pages From: Jovi Zhangwei Content-Type: multipart/alternative; boundary=f46d0435c034fe8053051718f4b6 Sender: owner-linux-mm@kvack.org List-ID: To: LKML , mgorman@suse.de, Sasha Levin , n-horiguchi@ah.jp.nec.com, Andrew Morton , hughd@google.com, linux-mm@kvack.org, vbabka@suse.cz, rientjes@google.com --f46d0435c034fe8053051718f4b6 Content-Type: text/plain; charset=UTF-8 Below kernel vm bug can be triggered by tcpdump which mmaped a lot of pages with GFP_COMP flag. [Mon May 25 05:29:33 2015] page:ffffea0015414000 count:66 mapcount:1 mapping: (null) index:0x0 [Mon May 25 05:29:33 2015] flags: 0x20047580004000(head) [Mon May 25 05:29:33 2015] page dumped because: VM_BUG_ON_PAGE(compound_order(page) && !PageTransHuge(page)) [Mon May 25 05:29:33 2015] ------------[ cut here ]------------ [Mon May 25 05:29:33 2015] kernel BUG at mm/migrate.c:1661! [Mon May 25 05:29:33 2015] invalid opcode: 0000 [#1] SMP The fix is simply disallow migrate mmaped compound pages, return 0 instead of report vm bug. Signed-off-by: Jovi Zhangwei --- mm/migrate.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mm/migrate.c b/mm/migrate.c index f53838f..839adef 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -1606,7 +1606,8 @@ static int numamigrate_isolate_page(pg_data_t *pgdat, struct page *page) { int page_lru; - VM_BUG_ON_PAGE(compound_order(page) && !PageTransHuge(page), page); + if (compound_order(page) && !PageTransHuge(page)) + return 0; /* Avoid migrating to a node that is nearly full */ if (!migrate_balanced_pgdat(pgdat, 1UL << compound_order(page))) -- 1.9.1 --f46d0435c034fe8053051718f4b6 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Below kernel v= m bug can be triggered by tcpdump which mmaped a lot of pages with GFP_COMP= flag.

[Mon May 25 05:29:33 2015] page:ffff= ea0015414000 count:66 mapcount:1 mapping: =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0(null) index:0x0
[Mon M= ay 25 05:29:33 2015] flags: 0x20047580004000(head)
[Mon May 25 05:29:33 2015] page dumped because: VM= _BUG_ON_PAGE(compound_order(page) && !PageTransHuge(page))
[Mon May 25 05:29:33 2015] -------= -----[ cut here ]------------
[Mon May 25 05:29:33 2015] kernel BUG at mm/migrate.c:1661!
[Mon May 25 05:29:33 2015] invalid op= code: 0000 [#1] SMP

The fix is simply disallow = migrate mmaped compound pages, return 0 instead of
report vm bug.

Signed-= off-by: Jovi Zhangwei <jovi.zhangwei@gmail.com>
---
=C2= =A0mm/migrate.c | 3 ++-
= =C2=A01 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/mm/migrate.c b/mm/migrate.c
index f53838f..839adef 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -1606,7 +1606,8 @@ static int numamigrate_isolate_page(pg_dat= a_t *pgdat, struct page *page)
=C2=A0{
=C2=A0 int page_lru;
=C2=A0
- VM_BUG_ON_PAGE(compoun= d_order(page) && !PageTransHuge(page), page);
+ i= f (compound_order(page) && !PageTransHuge(page))
+ return 0;
=C2=A0
<= div style=3D"font-size:12.8000001907349px">=C2=A0 /* Avoid migrating to a node that is nearly full */
=C2=A0 if (!migrate_balanced_pgdat(pgdat, 1UL << compou= nd_order(page)))
--=C2=A0
1.9.1
--f46d0435c034fe8053051718f4b6-- -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org