Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932249AbbKMAog (ORCPT ); Thu, 12 Nov 2015 19:44:36 -0500 Received: from mail-pa0-f45.google.com ([209.85.220.45]:33316 "EHLO mail-pa0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754369AbbKMAof (ORCPT ); Thu, 12 Nov 2015 19:44:35 -0500 From: Naoya Horiguchi To: Andrew Morton , "Kirill A. Shutemov" Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Naoya Horiguchi , Naoya Horiguchi Subject: [PATCH v1] mm: fix mapcount mismatch in hugepage migration Date: Fri, 13 Nov 2015 09:44:29 +0900 Message-Id: <1447375469-9298-1-git-send-email-n-horiguchi@ah.jp.nec.com> X-Mailer: git-send-email 1.7.1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2974 Lines: 66 try_to_unmap_one() should be able to handle hugetlb, but page_remove_rmap() in that function takes false as a compound flag, which breaks hugepage migration with the following message. Soft offlining page 0x1d4a00 at 0x7ff634a00000 soft offline: 0x1d4a00: migration failed 1, type 60000000000401c BUG: Bad page state in process sysctl pfn:1d4a00 page:ffffea0007528000 count:0 mapcount:0 mapping: (null) index:0x0 compound_mapcount: 10 flags: 0x600000000004008(uptodate|head) page dumped because: nonzero mapcount Modules linked in: cfg80211 rfkill crc32c_intel virtio_balloon serio_raw i2c_piix4 virtio_blk virtio_net ata_generic pata_acpi CPU: 3 PID: 11882 Comm: sysctl Tainted: G W 4.3.0-mmotm-2015-11-10-15-53-151112-1812-00015-53+ #240 Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011 ffffffff81a1a124 ffff8800da047bd0 ffffffff81340adf ffffea0007528000 ffff8800da047bf8 ffffffff8116e206 0000000000000009 ffffffff81f72538 ffffea0007528000 ffff8800da047c48 ffffffff8116e6d6 0000020000000000 Call Trace: [] dump_stack+0x44/0x55 [] bad_page+0xc6/0x110 [] free_pages_prepare+0x486/0x500 [] __free_pages_ok+0x1a/0xb0 [] __free_pages+0x21/0x40 [] update_and_free_page+0xa9/0x230 [] free_pool_huge_page+0xc1/0xe0 [] set_max_huge_pages+0x382/0x4d0 [] hugetlb_sysctl_handler_common+0xa2/0xd0 [] hugetlb_sysctl_handler+0x1e/0x20 [] proc_sys_call_handler+0xae/0xc0 [] proc_sys_write+0x14/0x20 [] __vfs_write+0x28/0xe0 [] ? percpu_down_read+0x14/0x60 [] vfs_write+0xa9/0x190 [] SyS_write+0x46/0xb0 [] entry_SYSCALL_64_fastpath+0x12/0x6a This patch simply fixes this by giving the compound flag via PageHuge. --- # This patch is against mmotm-2015-11-10-15-53 as a fix for "rmap: add argument # to charge compound page". Signed-off-by: Naoya Horiguchi --- mm/rmap.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git mmotm-2015-11-10-15-53/mm/rmap.c mmotm-2015-11-10-15-53_patched/mm/rmap.c index e90b81f..e045fea 100644 --- mmotm-2015-11-10-15-53/mm/rmap.c +++ mmotm-2015-11-10-15-53_patched/mm/rmap.c @@ -1508,7 +1508,7 @@ static int try_to_unmap_one(struct page *page, struct vm_area_struct *vma, } else dec_mm_counter(mm, MM_FILEPAGES); - page_remove_rmap(page, false); + page_remove_rmap(page, PageHuge(page)); page_cache_release(page); out_unmap: -- 1.7.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/