Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1518772

Re: [PATCH v2 03/12] mm: thp: introduce separate TTU flag for thp freezing

From Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Newsgroups linux.kernel
Subject Re: [PATCH v2 03/12] mm: thp: introduce separate TTU flag for thp freezing
Date 2016-11-10 10:20 +0100
Message-ID <sBTGx-3Ex-27@gated-at.bofh.it> (permalink)
References <sB1Ga-1xZ-7@gated-at.bofh.it> <sB1Ga-1xZ-29@gated-at.bofh.it> <sBT3Q-3a8-29@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Thu, Nov 10, 2016 at 02:01:56PM +0530, Anshuman Khandual wrote:
> On 11/08/2016 05:01 AM, Naoya Horiguchi wrote:
> > TTU_MIGRATION is used to convert pte into migration entry until thp split
> > completes. This behavior conflicts with thp migration added later patches,
>
> Hmm, could you please explain why it conflicts with the PMD based
> migration without split ? Why TTU_MIGRATION cannot be used to
> freeze/hold on the PMD while it's being migrated ?

try_to_unmap() is used both for thp split (via freeze_page()) and page
migration (via __unmap_and_move()). In freeze_page(), ttu_flag given for
head page is like below (assuming anonymous thp):

    (TTU_IGNORE_MLOCK | TTU_IGNORE_ACCESS | TTU_RMAP_LOCKED | \
     TTU_MIGRATION | TTU_SPLIT_HUGE_PMD)

and ttu_flag given for tail pages is:

    (TTU_IGNORE_MLOCK | TTU_IGNORE_ACCESS | TTU_RMAP_LOCKED | \
     TTU_MIGRATION)

__unmap_and_move() calls try_to_unmap() with ttu_flag:

    (TTU_MIGRATION | TTU_IGNORE_MLOCK | TTU_IGNORE_ACCESS)

Now I'm trying to insert a branch for thp migration at the top of
try_to_unmap_one() like below


  static int try_to_unmap_one(struct page *page, struct vm_area_struct *vma,
                       unsigned long address, void *arg)
  {
          ...
          if (flags & TTU_MIGRATION) {
                  if (!PageHuge(page) && PageTransCompound(page)) {
                          set_pmd_migration_entry(page, vma, address);
                          goto out;
                  }
          }

, so try_to_unmap() for tail pages called by thp split can go into thp
migration code path (which converts *pmd* into migration entry), while
the expectation is to freeze thp (which converts *pte* into migration entry.)

I detected this failure as a "bad page state" error in a testcase where
split_huge_page() is called from queue_pages_pte_range().

Anyway, I'll add this explanation into the patch description in the next post.

Thanks,
Naoya Horiguchi

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 03/12] mm: thp: introduce separate TTU flag for thp freezing Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> - 2016-11-08 00:40 +0100
  Re: [PATCH v2 03/12] mm: thp: introduce separate TTU flag for thp  freezing Anshuman Khandual <khandual@linux.vnet.ibm.com> - 2016-11-10 09:40 +0100
    Re: [PATCH v2 03/12] mm: thp: introduce separate TTU flag for thp  freezing Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> - 2016-11-10 10:20 +0100
      Re: [PATCH v2 03/12] mm: thp: introduce separate TTU flag for thp  freezing Anshuman Khandual <khandual@linux.vnet.ibm.com> - 2016-11-11 04:20 +0100
  Re: [PATCH v2 03/12] mm: thp: introduce separate TTU flag for thp  freezing "Kirill A. Shutemov" <kirill@shutemov.name> - 2016-11-11 12:20 +0100

csiph-web