Files
android_kernel_xiaomi_sm8450/include/linux
Naoya Horiguchi b5ff8161e3 mm: thp: introduce separate TTU flag for thp freezing
TTU_MIGRATION is used to convert pte into migration entry until thp
split completes.  This behavior conflicts with thp migration added later
patches, so let's introduce a new TTU flag specifically for freezing.

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)
  {
          ...
          /* PMD-mapped THP migration entry */
          if (!pvmw.pte && (flags & TTU_MIGRATION)) {
              if (!PageAnon(page))
                  continue;

              set_pmd_migration_entry(&pvmw, page);
              continue;
          }
	  ...
  }

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().

Link: http://lkml.kernel.org/r/20170717193955.20207-4-zi.yan@sent.com
Signed-off-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Signed-off-by: Zi Yan <zi.yan@cs.rutgers.edu>
Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Anshuman Khandual <khandual@linux.vnet.ibm.com>
Cc: Dave Hansen <dave.hansen@intel.com>
Cc: David Nellans <dnellans@nvidia.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Mel Gorman <mgorman@techsingularity.net>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Michal Hocko <mhocko@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2017-09-08 18:26:45 -07:00
..
2017-06-08 18:52:36 -07:00
2017-07-17 17:26:14 +02:00
2017-07-06 16:24:33 -07:00
2017-07-03 16:56:28 -06:00
2017-06-05 16:59:12 +02:00
2017-04-18 20:41:12 +02:00
2017-08-31 17:32:38 -04:00
2017-06-22 15:43:47 +01:00
2017-09-04 00:05:22 +02:00
2017-09-04 00:06:02 +02:00
2017-08-10 12:28:57 +02:00
2017-06-09 11:52:07 +02:00
2017-08-24 13:23:03 -07:00
2017-07-17 13:42:48 +02:00
2017-04-27 05:13:04 -04:00
2017-07-07 20:09:10 -04:00
2017-05-18 10:07:41 -04:00
2017-05-18 10:07:40 -04:00
2017-06-21 14:37:12 -04:00
2017-07-10 16:32:34 -07:00
2017-08-14 13:33:39 -07:00
2017-05-03 15:52:10 -07:00
2017-08-01 12:03:10 -07:00
2017-08-28 20:51:22 +02:00
2017-08-18 15:32:01 -07:00
2017-09-06 17:27:29 -07:00
2017-09-06 17:27:30 -07:00
2017-04-24 14:30:46 -04:00
2017-07-13 16:00:15 -04:00
2017-07-06 11:30:07 -04:00
2017-07-25 18:05:25 +02:00
2017-05-26 10:10:37 +02:00
2017-09-06 17:27:26 -07:00
2017-08-06 20:55:29 -07:00
2017-08-06 20:55:29 -07:00
2017-08-21 12:47:31 -07:00
2017-08-16 16:28:47 -07:00
2017-06-29 10:48:57 +01:00
2017-07-12 23:11:23 +02:00
2017-06-08 10:35:49 +02:00
2017-08-01 12:03:10 -07:00
2017-07-06 16:24:30 -07:00
2017-08-16 16:28:47 -07:00
2017-08-03 21:37:29 -07:00
2017-06-08 18:52:42 -07:00
2017-06-01 14:53:04 -04:00
2017-08-28 16:15:42 +02:00
2017-07-24 17:50:37 +02:00
2017-05-09 16:43:22 +03:00
2017-08-31 18:50:14 +02:00
2017-08-18 15:32:01 -07:00
2017-09-05 06:34:17 -07:00