Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757059AbcCCHoe (ORCPT ); Thu, 3 Mar 2016 02:44:34 -0500 Received: from mail-pf0-f182.google.com ([209.85.192.182]:33363 "EHLO mail-pf0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756684AbcCCHmQ (ORCPT ); Thu, 3 Mar 2016 02:42:16 -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 , linux-kernel@vger.kernel.org, Naoya Horiguchi , Naoya Horiguchi Subject: [PATCH v1 04/11] mm: thp: enable thp migration in generic path Date: Thu, 3 Mar 2016 16:41:51 +0900 Message-Id: <1456990918-30906-5-git-send-email-n-horiguchi@ah.jp.nec.com> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1456990918-30906-1-git-send-email-n-horiguchi@ah.jp.nec.com> References: <1456990918-30906-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 Content-Length: 2130 Lines: 53 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, 6 insertions(+), 3 deletions(-) diff --git v4.5-rc5-mmotm-2016-02-24-16-18/mm/migrate.c v4.5-rc5-mmotm-2016-02-24-16-18_patched/mm/migrate.c index 14164f6..bd8bfa4 100644 --- v4.5-rc5-mmotm-2016-02-24-16-18/mm/migrate.c +++ v4.5-rc5-mmotm-2016-02-24-16-18_patched/mm/migrate.c @@ -969,7 +969,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.5-rc5-mmotm-2016-02-24-16-18/mm/rmap.c v4.5-rc5-mmotm-2016-02-24-16-18_patched/mm/rmap.c index 02f0bfc..49198b8 100644 --- v4.5-rc5-mmotm-2016-02-24-16-18/mm/rmap.c +++ v4.5-rc5-mmotm-2016-02-24-16-18_patched/mm/rmap.c @@ -1427,6 +1427,11 @@ 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 (!PageHuge(page) && PageTransHuge(page)) { + VM_BUG_ON_PAGE(!(flags & TTU_MIGRATION), page); + return set_pmd_migration_entry(page, mm, address); + } + /* munlock has nothing to gain from examining un-locked vmas */ if ((flags & TTU_MUNLOCK) && !(vma->vm_flags & VM_LOCKED)) goto out; @@ -1610,8 +1615,6 @@ int try_to_unmap(struct page *page, enum ttu_flags flags) .anon_lock = page_lock_anon_vma_read, }; - VM_BUG_ON_PAGE(!PageHuge(page) && PageTransHuge(page), page); - /* * During exec, a temporary VMA is setup and later moved. * The VMA is moved under the anon_vma lock but not the -- 2.7.0