From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752837AbcKHAbw (ORCPT ); Mon, 7 Nov 2016 19:31:52 -0500 Received: from mail-pf0-f193.google.com ([209.85.192.193]:35721 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752164AbcKHAbu (ORCPT ); Mon, 7 Nov 2016 19:31:50 -0500 From: Naoya Horiguchi To: linux-mm@kvack.org Cc: "Kirill A. Shutemov" , Hugh Dickins , Andrew Morton , Dave Hansen , Andrea Arcangeli , Mel Gorman , Michal Hocko , Vlastimil Babka , Pavel Emelyanov , Zi Yan , Balbir Singh , linux-kernel@vger.kernel.org, Naoya Horiguchi , Naoya Horiguchi Subject: [PATCH v2 06/12] mm: thp: enable thp migration in generic path Date: Tue, 8 Nov 2016 08:31:51 +0900 Message-Id: <1478561517-4317-7-git-send-email-n-horiguchi@ah.jp.nec.com> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1478561517-4317-1-git-send-email-n-horiguchi@ah.jp.nec.com> References: <1478561517-4317-1-git-send-email-n-horiguchi@ah.jp.nec.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch makes it possible to support thp migration gradually. If you fail to allocate a destination page as a thp, you just split the source thp as we do now, and then enter the normal page migration. If you succeed to allocate destination thp, you enter thp migration. Subsequent patches actually enable thp migration for each caller of page migration by allowing its get_new_page() callback to allocate thps. Signed-off-by: Naoya Horiguchi --- mm/migrate.c | 2 +- mm/rmap.c | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git v4.9-rc2-mmotm-2016-10-27-18-27/mm/migrate.c v4.9-rc2-mmotm-2016-10-27-18-27_patched/mm/migrate.c index 54f2eb6..97ab8d9 100644 --- v4.9-rc2-mmotm-2016-10-27-18-27/mm/migrate.c +++ v4.9-rc2-mmotm-2016-10-27-18-27_patched/mm/migrate.c @@ -1142,7 +1142,7 @@ static ICE_noinline int unmap_and_move(new_page_t get_new_page, goto out; } - if (unlikely(PageTransHuge(page))) { + if (unlikely(PageTransHuge(page) && !PageTransHuge(newpage))) { lock_page(page); rc = split_huge_page(page); unlock_page(page); diff --git v4.9-rc2-mmotm-2016-10-27-18-27/mm/rmap.c v4.9-rc2-mmotm-2016-10-27-18-27_patched/mm/rmap.c index a4be307..a0b665c 100644 --- v4.9-rc2-mmotm-2016-10-27-18-27/mm/rmap.c +++ v4.9-rc2-mmotm-2016-10-27-18-27_patched/mm/rmap.c @@ -1443,6 +1443,13 @@ static int try_to_unmap_one(struct page *page, struct vm_area_struct *vma, struct rmap_private *rp = arg; enum ttu_flags flags = rp->flags; + if (flags & TTU_MIGRATION) { + if (!PageHuge(page) && PageTransCompound(page)) { + set_pmd_migration_entry(page, vma, address); + goto out; + } + } + /* munlock has nothing to gain from examining un-locked vmas */ if ((flags & TTU_MUNLOCK) && !(vma->vm_flags & VM_LOCKED)) goto out; -- 2.7.0