linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V3 0/5] arm64/mm: Enable HugeTLB migration
@ 2018-10-23 13:01 Anshuman Khandual
  2018-10-23 13:01 ` [PATCH V3 1/5] mm/hugetlb: Distinguish between migratability and movability Anshuman Khandual
                   ` (5 more replies)
  0 siblings, 6 replies; 19+ messages in thread
From: Anshuman Khandual @ 2018-10-23 13:01 UTC (permalink / raw)
  To: linux-mm, linux-arm-kernel, linux-kernel
  Cc: suzuki.poulose, punit.agrawal, will.deacon, Steven.Price,
	steve.capper, catalin.marinas, mhocko, akpm, mike.kravetz,
	n-horiguchi

This patch series enables HugeTLB migration support for all supported
huge page sizes at all levels including contiguous bit implementation.
Following HugeTLB migration support matrix has been enabled with this
patch series. All permutations have been tested except for the 16GB.

         CONT PTE    PMD    CONT PMD    PUD
         --------    ---    --------    ---
4K:         64K     2M         32M     1G
16K:         2M    32M          1G
64K:         2M   512M         16G

First the series adds migration support for PUD based huge pages. It
then adds a platform specific hook to query an architecture if a
given huge page size is supported for migration while also providing
a default fallback option preserving the existing semantics which just
checks for (PMD|PUD|PGDIR)_SHIFT macros. The last two patches enables
HugeTLB migration on arm64 and subscribe to this new platform specific
hook by defining an override.

The second patch differentiates between movability and migratability
aspects of huge pages and implements hugepage_movable_supported() which
can then be used during allocation to decide whether to place the huge
page in movable zone or not.

Changes in V3:

- Re-ordered patches 1 and 2 per Michal
- s/Movability/Migratability/ in unmap_and_move_huge_page() per Naoya

Changes in V2: (https://lkml.org/lkml/2018/10/12/190)

- Added a new patch which differentiates migratability and movability
  of huge pages and implements hugepage_movable_supported() function
  as suggested by Michal Hocko.

Anshuman Khandual (5):
  mm/hugetlb: Distinguish between migratability and movability
  mm/hugetlb: Enable PUD level huge page migration
  mm/hugetlb: Enable arch specific huge page size support for migration
  arm64/mm: Enable HugeTLB migration
  arm64/mm: Enable HugeTLB migration for contiguous bit HugeTLB pages

 arch/arm64/Kconfig               |  4 ++++
 arch/arm64/include/asm/hugetlb.h |  5 +++++
 arch/arm64/mm/hugetlbpage.c      | 20 +++++++++++++++++
 include/linux/hugetlb.h          | 48 +++++++++++++++++++++++++++++++++++++---
 mm/hugetlb.c                     |  2 +-
 mm/migrate.c                     |  2 +-
 6 files changed, 76 insertions(+), 5 deletions(-)

-- 
2.7.4


^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH V3 1/5] mm/hugetlb: Distinguish between migratability and movability
  2018-10-23 13:01 [PATCH V3 0/5] arm64/mm: Enable HugeTLB migration Anshuman Khandual
@ 2018-10-23 13:01 ` Anshuman Khandual
  2018-10-24 13:54   ` Michal Hocko
  2018-11-08 10:33   ` Steve Capper
  2018-10-23 13:01 ` [PATCH V3 2/5] mm/hugetlb: Enable PUD level huge page migration Anshuman Khandual
                   ` (4 subsequent siblings)
  5 siblings, 2 replies; 19+ messages in thread
From: Anshuman Khandual @ 2018-10-23 13:01 UTC (permalink / raw)
  To: linux-mm, linux-arm-kernel, linux-kernel
  Cc: suzuki.poulose, punit.agrawal, will.deacon, Steven.Price,
	steve.capper, catalin.marinas, mhocko, akpm, mike.kravetz,
	n-horiguchi

During huge page allocation it's migratability is checked to determine if
it should be placed under movable zones with GFP_HIGHUSER_MOVABLE. But the
movability aspect of the huge page could depend on other factors than just
migratability. Movability in itself is a distinct property which should not
be tied with migratability alone.

This differentiates these two and implements an enhanced movability check
which also considers huge page size to determine if it is feasible to be
placed under a movable zone. At present it just checks for gigantic pages
but going forward it can incorporate other enhanced checks.

Reviewed-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Suggested-by: Michal Hocko <mhocko@kernel.org>
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
---
 include/linux/hugetlb.h | 30 ++++++++++++++++++++++++++++++
 mm/hugetlb.c            |  2 +-
 mm/migrate.c            |  2 +-
 3 files changed, 32 insertions(+), 2 deletions(-)

diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index 087fd5f4..1b858d7 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -506,6 +506,31 @@ static inline bool hugepage_migration_supported(struct hstate *h)
 #endif
 }
 
+/*
+ * Movability check is different as compared to migration check.
+ * It determines whether or not a huge page should be placed on
+ * movable zone or not. Movability of any huge page should be
+ * required only if huge page size is supported for migration.
+ * There wont be any reason for the huge page to be movable if
+ * it is not migratable to start with. Also the size of the huge
+ * page should be large enough to be placed under a movable zone
+ * and still feasible enough to be migratable. Just the presence
+ * in movable zone does not make the migration feasible.
+ *
+ * So even though large huge page sizes like the gigantic ones
+ * are migratable they should not be movable because its not
+ * feasible to migrate them from movable zone.
+ */
+static inline bool hugepage_movable_supported(struct hstate *h)
+{
+	if (!hugepage_migration_supported(h))
+		return false;
+
+	if (hstate_is_gigantic(h))
+		return false;
+	return true;
+}
+
 static inline spinlock_t *huge_pte_lockptr(struct hstate *h,
 					   struct mm_struct *mm, pte_t *pte)
 {
@@ -602,6 +627,11 @@ static inline bool hugepage_migration_supported(struct hstate *h)
 	return false;
 }
 
+static inline bool hugepage_movable_supported(struct hstate *h)
+{
+	return false;
+}
+
 static inline spinlock_t *huge_pte_lockptr(struct hstate *h,
 					   struct mm_struct *mm, pte_t *pte)
 {
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 5c390f5..f810cf0 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -919,7 +919,7 @@ static struct page *dequeue_huge_page_nodemask(struct hstate *h, gfp_t gfp_mask,
 /* Movability of hugepages depends on migration support. */
 static inline gfp_t htlb_alloc_mask(struct hstate *h)
 {
-	if (hugepage_migration_supported(h))
+	if (hugepage_movable_supported(h))
 		return GFP_HIGHUSER_MOVABLE;
 	else
 		return GFP_HIGHUSER;
diff --git a/mm/migrate.c b/mm/migrate.c
index 84381b5..bfda9e4 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -1272,7 +1272,7 @@ static int unmap_and_move_huge_page(new_page_t get_new_page,
 	struct anon_vma *anon_vma = NULL;
 
 	/*
-	 * Movability of hugepages depends on architectures and hugepage size.
+	 * Migratability of hugepages depends on architectures and their size.
 	 * This check is necessary because some callers of hugepage migration
 	 * like soft offline and memory hotremove don't walk through page
 	 * tables or check whether the hugepage is pmd-based or not before
-- 
2.7.4


^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH V3 2/5] mm/hugetlb: Enable PUD level huge page migration
  2018-10-23 13:01 [PATCH V3 0/5] arm64/mm: Enable HugeTLB migration Anshuman Khandual
  2018-10-23 13:01 ` [PATCH V3 1/5] mm/hugetlb: Distinguish between migratability and movability Anshuman Khandual
@ 2018-10-23 13:01 ` Anshuman Khandual
  2018-11-08 10:34   ` Steve Capper
  2018-10-23 13:01 ` [PATCH V3 3/5] mm/hugetlb: Enable arch specific huge page size support for migration Anshuman Khandual
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 19+ messages in thread
From: Anshuman Khandual @ 2018-10-23 13:01 UTC (permalink / raw)
  To: linux-mm, linux-arm-kernel, linux-kernel
  Cc: suzuki.poulose, punit.agrawal, will.deacon, Steven.Price,
	steve.capper, catalin.marinas, mhocko, akpm, mike.kravetz,
	n-horiguchi

Architectures like arm64 have PUD level HugeTLB pages for certain configs
(1GB huge page is PUD based on ARM64_4K_PAGES base page size) that can be
enabled for migration. It can be achieved through checking for PUD_SHIFT
order based HugeTLB pages during migration.

Reviewed-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
---
 include/linux/hugetlb.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index 1b858d7..70bcd89 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -497,7 +497,8 @@ static inline bool hugepage_migration_supported(struct hstate *h)
 {
 #ifdef CONFIG_ARCH_ENABLE_HUGEPAGE_MIGRATION
 	if ((huge_page_shift(h) == PMD_SHIFT) ||
-		(huge_page_shift(h) == PGDIR_SHIFT))
+		(huge_page_shift(h) == PUD_SHIFT) ||
+			(huge_page_shift(h) == PGDIR_SHIFT))
 		return true;
 	else
 		return false;
-- 
2.7.4


^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH V3 3/5] mm/hugetlb: Enable arch specific huge page size support for migration
  2018-10-23 13:01 [PATCH V3 0/5] arm64/mm: Enable HugeTLB migration Anshuman Khandual
  2018-10-23 13:01 ` [PATCH V3 1/5] mm/hugetlb: Distinguish between migratability and movability Anshuman Khandual
  2018-10-23 13:01 ` [PATCH V3 2/5] mm/hugetlb: Enable PUD level huge page migration Anshuman Khandual
@ 2018-10-23 13:01 ` Anshuman Khandual
  2018-10-24 13:56   ` Michal Hocko
  2018-11-08 10:35   ` Steve Capper
  2018-10-23 13:02 ` [PATCH V3 4/5] arm64/mm: Enable HugeTLB migration Anshuman Khandual
                   ` (2 subsequent siblings)
  5 siblings, 2 replies; 19+ messages in thread
From: Anshuman Khandual @ 2018-10-23 13:01 UTC (permalink / raw)
  To: linux-mm, linux-arm-kernel, linux-kernel
  Cc: suzuki.poulose, punit.agrawal, will.deacon, Steven.Price,
	steve.capper, catalin.marinas, mhocko, akpm, mike.kravetz,
	n-horiguchi

Architectures like arm64 have HugeTLB page sizes which are different than
generic sizes at PMD, PUD, PGD level and implemented via contiguous bits.
At present these special size HugeTLB pages cannot be identified through
macros like (PMD|PUD|PGDIR)_SHIFT and hence chosen not be migrated.

Enabling migration support for these special HugeTLB page sizes along with
the generic ones (PMD|PUD|PGD) would require identifying all of them on a
given platform. A platform specific hook can precisely enumerate all huge
page sizes supported for migration. Instead of comparing against standard
huge page orders let hugetlb_migration_support() function call a platform
hook arch_hugetlb_migration_support(). Default definition for the platform
hook maintains existing semantics which checks standard huge page order.
But an architecture can choose to override the default and provide support
for a comprehensive set of huge page sizes.

Reviewed-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
---
 include/linux/hugetlb.h | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index 70bcd89..4cc3871 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -493,18 +493,29 @@ static inline pgoff_t basepage_index(struct page *page)
 extern int dissolve_free_huge_page(struct page *page);
 extern int dissolve_free_huge_pages(unsigned long start_pfn,
 				    unsigned long end_pfn);
-static inline bool hugepage_migration_supported(struct hstate *h)
-{
+
 #ifdef CONFIG_ARCH_ENABLE_HUGEPAGE_MIGRATION
+#ifndef arch_hugetlb_migration_supported
+static inline bool arch_hugetlb_migration_supported(struct hstate *h)
+{
 	if ((huge_page_shift(h) == PMD_SHIFT) ||
 		(huge_page_shift(h) == PUD_SHIFT) ||
 			(huge_page_shift(h) == PGDIR_SHIFT))
 		return true;
 	else
 		return false;
+}
+#endif
 #else
+static inline bool arch_hugetlb_migration_supported(struct hstate *h)
+{
 	return false;
+}
 #endif
+
+static inline bool hugepage_migration_supported(struct hstate *h)
+{
+	return arch_hugetlb_migration_supported(h);
 }
 
 /*
-- 
2.7.4


^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH V3 4/5] arm64/mm: Enable HugeTLB migration
  2018-10-23 13:01 [PATCH V3 0/5] arm64/mm: Enable HugeTLB migration Anshuman Khandual
                   ` (2 preceding siblings ...)
  2018-10-23 13:01 ` [PATCH V3 3/5] mm/hugetlb: Enable arch specific huge page size support for migration Anshuman Khandual
@ 2018-10-23 13:02 ` Anshuman Khandual
  2018-11-08 10:35   ` Steve Capper
  2018-11-23 14:42   ` Catalin Marinas
  2018-10-23 13:02 ` [PATCH V3 5/5] arm64/mm: Enable HugeTLB migration for contiguous bit HugeTLB pages Anshuman Khandual
  2018-11-23 15:08 ` [PATCH V3 0/5] arm64/mm: Enable HugeTLB migration Anshuman Khandual
  5 siblings, 2 replies; 19+ messages in thread
From: Anshuman Khandual @ 2018-10-23 13:02 UTC (permalink / raw)
  To: linux-mm, linux-arm-kernel, linux-kernel
  Cc: suzuki.poulose, punit.agrawal, will.deacon, Steven.Price,
	steve.capper, catalin.marinas, mhocko, akpm, mike.kravetz,
	n-horiguchi

Let arm64 subscribe to generic HugeTLB page migration framework. Right now
this only works on the following PMD and PUD level HugeTLB page sizes with
various kernel base page size combinations.

       CONT PTE    PMD    CONT PMD    PUD
       --------    ---    --------    ---
4K:         NA     2M         NA      1G
16K:        NA    32M         NA
64K:        NA   512M         NA

Reviewed-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
---
 arch/arm64/Kconfig | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index a8ae30f..4b3e269 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -1331,6 +1331,10 @@ config SYSVIPC_COMPAT
 	def_bool y
 	depends on COMPAT && SYSVIPC
 
+config ARCH_ENABLE_HUGEPAGE_MIGRATION
+	def_bool y
+	depends on HUGETLB_PAGE && MIGRATION
+
 menu "Power management options"
 
 source "kernel/power/Kconfig"
-- 
2.7.4


^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH V3 5/5] arm64/mm: Enable HugeTLB migration for contiguous bit HugeTLB pages
  2018-10-23 13:01 [PATCH V3 0/5] arm64/mm: Enable HugeTLB migration Anshuman Khandual
                   ` (3 preceding siblings ...)
  2018-10-23 13:02 ` [PATCH V3 4/5] arm64/mm: Enable HugeTLB migration Anshuman Khandual
@ 2018-10-23 13:02 ` Anshuman Khandual
  2018-11-08 10:36   ` Steve Capper
  2018-11-23 14:42   ` Catalin Marinas
  2018-11-23 15:08 ` [PATCH V3 0/5] arm64/mm: Enable HugeTLB migration Anshuman Khandual
  5 siblings, 2 replies; 19+ messages in thread
From: Anshuman Khandual @ 2018-10-23 13:02 UTC (permalink / raw)
  To: linux-mm, linux-arm-kernel, linux-kernel
  Cc: suzuki.poulose, punit.agrawal, will.deacon, Steven.Price,
	steve.capper, catalin.marinas, mhocko, akpm, mike.kravetz,
	n-horiguchi

Let arm64 subscribe to the previously added framework in which architecture
can inform whether a given huge page size is supported for migration. This
just overrides the default function arch_hugetlb_migration_supported() and
enables migration for all possible HugeTLB page sizes on arm64. With this,
HugeTLB migration support on arm64 now covers all possible HugeTLB options.

        CONT PTE    PMD    CONT PMD    PUD
        --------    ---    --------    ---
4K:        64K      2M        32M      1G
16K:        2M     32M         1G
64K:        2M    512M        16G

Reviewed-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
---
 arch/arm64/include/asm/hugetlb.h |  5 +++++
 arch/arm64/mm/hugetlbpage.c      | 20 ++++++++++++++++++++
 2 files changed, 25 insertions(+)

diff --git a/arch/arm64/include/asm/hugetlb.h b/arch/arm64/include/asm/hugetlb.h
index e73f685..656f70e 100644
--- a/arch/arm64/include/asm/hugetlb.h
+++ b/arch/arm64/include/asm/hugetlb.h
@@ -20,6 +20,11 @@
 
 #include <asm/page.h>
 
+#ifdef CONFIG_ARCH_ENABLE_HUGEPAGE_MIGRATION
+#define arch_hugetlb_migration_supported arch_hugetlb_migration_supported
+extern bool arch_hugetlb_migration_supported(struct hstate *h);
+#endif
+
 static inline pte_t huge_ptep_get(pte_t *ptep)
 {
 	return READ_ONCE(*ptep);
diff --git a/arch/arm64/mm/hugetlbpage.c b/arch/arm64/mm/hugetlbpage.c
index 21512ca..f3afdcf 100644
--- a/arch/arm64/mm/hugetlbpage.c
+++ b/arch/arm64/mm/hugetlbpage.c
@@ -27,6 +27,26 @@
 #include <asm/tlbflush.h>
 #include <asm/pgalloc.h>
 
+#ifdef CONFIG_ARCH_ENABLE_HUGEPAGE_MIGRATION
+bool arch_hugetlb_migration_supported(struct hstate *h)
+{
+	size_t pagesize = huge_page_size(h);
+
+	switch (pagesize) {
+#ifdef CONFIG_ARM64_4K_PAGES
+	case PUD_SIZE:
+#endif
+	case PMD_SIZE:
+	case CONT_PMD_SIZE:
+	case CONT_PTE_SIZE:
+		return true;
+	}
+	pr_warn("%s: unrecognized huge page size 0x%lx\n",
+			__func__, pagesize);
+	return false;
+}
+#endif
+
 int pmd_huge(pmd_t pmd)
 {
 	return pmd_val(pmd) && !(pmd_val(pmd) & PMD_TABLE_BIT);
-- 
2.7.4


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH V3 1/5] mm/hugetlb: Distinguish between migratability and movability
  2018-10-23 13:01 ` [PATCH V3 1/5] mm/hugetlb: Distinguish between migratability and movability Anshuman Khandual
@ 2018-10-24 13:54   ` Michal Hocko
  2018-11-08 10:33   ` Steve Capper
  1 sibling, 0 replies; 19+ messages in thread
From: Michal Hocko @ 2018-10-24 13:54 UTC (permalink / raw)
  To: Anshuman Khandual
  Cc: linux-mm, linux-arm-kernel, linux-kernel, suzuki.poulose,
	punit.agrawal, will.deacon, Steven.Price, steve.capper,
	catalin.marinas, akpm, mike.kravetz, n-horiguchi

On Tue 23-10-18 18:31:57, Anshuman Khandual wrote:
> During huge page allocation it's migratability is checked to determine if
> it should be placed under movable zones with GFP_HIGHUSER_MOVABLE. But the
> movability aspect of the huge page could depend on other factors than just
> migratability. Movability in itself is a distinct property which should not
> be tied with migratability alone.
> 
> This differentiates these two and implements an enhanced movability check
> which also considers huge page size to determine if it is feasible to be
> placed under a movable zone. At present it just checks for gigantic pages
> but going forward it can incorporate other enhanced checks.
> 
> Reviewed-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
> Suggested-by: Michal Hocko <mhocko@kernel.org>
> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>

Acked-by: Michal Hocko <mhocko@suse.com>

Thanks!

> ---
>  include/linux/hugetlb.h | 30 ++++++++++++++++++++++++++++++
>  mm/hugetlb.c            |  2 +-
>  mm/migrate.c            |  2 +-
>  3 files changed, 32 insertions(+), 2 deletions(-)
> 
> diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
> index 087fd5f4..1b858d7 100644
> --- a/include/linux/hugetlb.h
> +++ b/include/linux/hugetlb.h
> @@ -506,6 +506,31 @@ static inline bool hugepage_migration_supported(struct hstate *h)
>  #endif
>  }
>  
> +/*
> + * Movability check is different as compared to migration check.
> + * It determines whether or not a huge page should be placed on
> + * movable zone or not. Movability of any huge page should be
> + * required only if huge page size is supported for migration.
> + * There wont be any reason for the huge page to be movable if
> + * it is not migratable to start with. Also the size of the huge
> + * page should be large enough to be placed under a movable zone
> + * and still feasible enough to be migratable. Just the presence
> + * in movable zone does not make the migration feasible.
> + *
> + * So even though large huge page sizes like the gigantic ones
> + * are migratable they should not be movable because its not
> + * feasible to migrate them from movable zone.
> + */
> +static inline bool hugepage_movable_supported(struct hstate *h)
> +{
> +	if (!hugepage_migration_supported(h))
> +		return false;
> +
> +	if (hstate_is_gigantic(h))
> +		return false;
> +	return true;
> +}
> +
>  static inline spinlock_t *huge_pte_lockptr(struct hstate *h,
>  					   struct mm_struct *mm, pte_t *pte)
>  {
> @@ -602,6 +627,11 @@ static inline bool hugepage_migration_supported(struct hstate *h)
>  	return false;
>  }
>  
> +static inline bool hugepage_movable_supported(struct hstate *h)
> +{
> +	return false;
> +}
> +
>  static inline spinlock_t *huge_pte_lockptr(struct hstate *h,
>  					   struct mm_struct *mm, pte_t *pte)
>  {
> diff --git a/mm/hugetlb.c b/mm/hugetlb.c
> index 5c390f5..f810cf0 100644
> --- a/mm/hugetlb.c
> +++ b/mm/hugetlb.c
> @@ -919,7 +919,7 @@ static struct page *dequeue_huge_page_nodemask(struct hstate *h, gfp_t gfp_mask,
>  /* Movability of hugepages depends on migration support. */
>  static inline gfp_t htlb_alloc_mask(struct hstate *h)
>  {
> -	if (hugepage_migration_supported(h))
> +	if (hugepage_movable_supported(h))
>  		return GFP_HIGHUSER_MOVABLE;
>  	else
>  		return GFP_HIGHUSER;
> diff --git a/mm/migrate.c b/mm/migrate.c
> index 84381b5..bfda9e4 100644
> --- a/mm/migrate.c
> +++ b/mm/migrate.c
> @@ -1272,7 +1272,7 @@ static int unmap_and_move_huge_page(new_page_t get_new_page,
>  	struct anon_vma *anon_vma = NULL;
>  
>  	/*
> -	 * Movability of hugepages depends on architectures and hugepage size.
> +	 * Migratability of hugepages depends on architectures and their size.
>  	 * This check is necessary because some callers of hugepage migration
>  	 * like soft offline and memory hotremove don't walk through page
>  	 * tables or check whether the hugepage is pmd-based or not before
> -- 
> 2.7.4

-- 
Michal Hocko
SUSE Labs

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH V3 3/5] mm/hugetlb: Enable arch specific huge page size support for migration
  2018-10-23 13:01 ` [PATCH V3 3/5] mm/hugetlb: Enable arch specific huge page size support for migration Anshuman Khandual
@ 2018-10-24 13:56   ` Michal Hocko
  2018-10-24 13:58     ` Michal Hocko
  2018-11-08 10:35   ` Steve Capper
  1 sibling, 1 reply; 19+ messages in thread
From: Michal Hocko @ 2018-10-24 13:56 UTC (permalink / raw)
  To: Anshuman Khandual
  Cc: linux-mm, linux-arm-kernel, linux-kernel, suzuki.poulose,
	punit.agrawal, will.deacon, Steven.Price, steve.capper,
	catalin.marinas, akpm, mike.kravetz, n-horiguchi

On Tue 23-10-18 18:31:59, Anshuman Khandual wrote:
> Architectures like arm64 have HugeTLB page sizes which are different than
> generic sizes at PMD, PUD, PGD level and implemented via contiguous bits.
> At present these special size HugeTLB pages cannot be identified through
> macros like (PMD|PUD|PGDIR)_SHIFT and hence chosen not be migrated.
> 
> Enabling migration support for these special HugeTLB page sizes along with
> the generic ones (PMD|PUD|PGD) would require identifying all of them on a
> given platform. A platform specific hook can precisely enumerate all huge
> page sizes supported for migration. Instead of comparing against standard
> huge page orders let hugetlb_migration_support() function call a platform
> hook arch_hugetlb_migration_support(). Default definition for the platform
> hook maintains existing semantics which checks standard huge page order.
> But an architecture can choose to override the default and provide support
> for a comprehensive set of huge page sizes.
> 
> Reviewed-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>

Acked-by: Michal Hocko <mhocko@use.com>

> ---
>  include/linux/hugetlb.h | 15 +++++++++++++--
>  1 file changed, 13 insertions(+), 2 deletions(-)
> 
> diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
> index 70bcd89..4cc3871 100644
> --- a/include/linux/hugetlb.h
> +++ b/include/linux/hugetlb.h
> @@ -493,18 +493,29 @@ static inline pgoff_t basepage_index(struct page *page)
>  extern int dissolve_free_huge_page(struct page *page);
>  extern int dissolve_free_huge_pages(unsigned long start_pfn,
>  				    unsigned long end_pfn);
> -static inline bool hugepage_migration_supported(struct hstate *h)
> -{
> +
>  #ifdef CONFIG_ARCH_ENABLE_HUGEPAGE_MIGRATION
> +#ifndef arch_hugetlb_migration_supported
> +static inline bool arch_hugetlb_migration_supported(struct hstate *h)
> +{
>  	if ((huge_page_shift(h) == PMD_SHIFT) ||
>  		(huge_page_shift(h) == PUD_SHIFT) ||
>  			(huge_page_shift(h) == PGDIR_SHIFT))
>  		return true;
>  	else
>  		return false;
> +}
> +#endif
>  #else
> +static inline bool arch_hugetlb_migration_supported(struct hstate *h)
> +{
>  	return false;
> +}
>  #endif
> +
> +static inline bool hugepage_migration_supported(struct hstate *h)
> +{
> +	return arch_hugetlb_migration_supported(h);
>  }
>  
>  /*
> -- 
> 2.7.4

-- 
Michal Hocko
SUSE Labs

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH V3 3/5] mm/hugetlb: Enable arch specific huge page size support for migration
  2018-10-24 13:56   ` Michal Hocko
@ 2018-10-24 13:58     ` Michal Hocko
  2018-10-25  6:23       ` Anshuman Khandual
  0 siblings, 1 reply; 19+ messages in thread
From: Michal Hocko @ 2018-10-24 13:58 UTC (permalink / raw)
  To: Anshuman Khandual
  Cc: linux-mm, linux-arm-kernel, linux-kernel, suzuki.poulose,
	punit.agrawal, will.deacon, Steven.Price, steve.capper,
	catalin.marinas, akpm, mike.kravetz, n-horiguchi

On Wed 24-10-18 15:56:39, Michal Hocko wrote:
> On Tue 23-10-18 18:31:59, Anshuman Khandual wrote:
> > Architectures like arm64 have HugeTLB page sizes which are different than
> > generic sizes at PMD, PUD, PGD level and implemented via contiguous bits.
> > At present these special size HugeTLB pages cannot be identified through
> > macros like (PMD|PUD|PGDIR)_SHIFT and hence chosen not be migrated.
> > 
> > Enabling migration support for these special HugeTLB page sizes along with
> > the generic ones (PMD|PUD|PGD) would require identifying all of them on a
> > given platform. A platform specific hook can precisely enumerate all huge
> > page sizes supported for migration. Instead of comparing against standard
> > huge page orders let hugetlb_migration_support() function call a platform
> > hook arch_hugetlb_migration_support(). Default definition for the platform
> > hook maintains existing semantics which checks standard huge page order.
> > But an architecture can choose to override the default and provide support
> > for a comprehensive set of huge page sizes.
> > 
> > Reviewed-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
> > Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
> 
> Acked-by: Michal Hocko <mhocko@use.com>

fat fingers here, should be mhocko@suse.com of course.
-- 
Michal Hocko
SUSE Labs

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH V3 3/5] mm/hugetlb: Enable arch specific huge page size support for migration
  2018-10-24 13:58     ` Michal Hocko
@ 2018-10-25  6:23       ` Anshuman Khandual
  2018-10-25  7:45         ` Michal Hocko
  0 siblings, 1 reply; 19+ messages in thread
From: Anshuman Khandual @ 2018-10-25  6:23 UTC (permalink / raw)
  To: Michal Hocko
  Cc: linux-mm, linux-arm-kernel, linux-kernel, suzuki.poulose,
	punit.agrawal, will.deacon, Steven.Price, steve.capper,
	catalin.marinas, akpm, mike.kravetz, n-horiguchi



On 10/24/2018 07:28 PM, Michal Hocko wrote:
> On Wed 24-10-18 15:56:39, Michal Hocko wrote:
>> On Tue 23-10-18 18:31:59, Anshuman Khandual wrote:
>>> Architectures like arm64 have HugeTLB page sizes which are different than
>>> generic sizes at PMD, PUD, PGD level and implemented via contiguous bits.
>>> At present these special size HugeTLB pages cannot be identified through
>>> macros like (PMD|PUD|PGDIR)_SHIFT and hence chosen not be migrated.
>>>
>>> Enabling migration support for these special HugeTLB page sizes along with
>>> the generic ones (PMD|PUD|PGD) would require identifying all of them on a
>>> given platform. A platform specific hook can precisely enumerate all huge
>>> page sizes supported for migration. Instead of comparing against standard
>>> huge page orders let hugetlb_migration_support() function call a platform
>>> hook arch_hugetlb_migration_support(). Default definition for the platform
>>> hook maintains existing semantics which checks standard huge page order.
>>> But an architecture can choose to override the default and provide support
>>> for a comprehensive set of huge page sizes.
>>>
>>> Reviewed-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
>>> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
>>
>> Acked-by: Michal Hocko <mhocko@use.com>
> 
> fat fingers here, should be mhocko@suse.com of course.

Sure no problems. As we had discussed earlier and agreed to keep the previous
patch "mm/hugetlb: Enable PUD level huge page migration" separate and not fold
into this one, I will assume your ACK on it as well unless your disagree.

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH V3 3/5] mm/hugetlb: Enable arch specific huge page size support for migration
  2018-10-25  6:23       ` Anshuman Khandual
@ 2018-10-25  7:45         ` Michal Hocko
  0 siblings, 0 replies; 19+ messages in thread
From: Michal Hocko @ 2018-10-25  7:45 UTC (permalink / raw)
  To: Anshuman Khandual
  Cc: linux-mm, linux-arm-kernel, linux-kernel, suzuki.poulose,
	punit.agrawal, will.deacon, Steven.Price, steve.capper,
	catalin.marinas, akpm, mike.kravetz, n-horiguchi

On Thu 25-10-18 11:53:34, Anshuman Khandual wrote:
> 
> 
> On 10/24/2018 07:28 PM, Michal Hocko wrote:
> > On Wed 24-10-18 15:56:39, Michal Hocko wrote:
> >> On Tue 23-10-18 18:31:59, Anshuman Khandual wrote:
> >>> Architectures like arm64 have HugeTLB page sizes which are different than
> >>> generic sizes at PMD, PUD, PGD level and implemented via contiguous bits.
> >>> At present these special size HugeTLB pages cannot be identified through
> >>> macros like (PMD|PUD|PGDIR)_SHIFT and hence chosen not be migrated.
> >>>
> >>> Enabling migration support for these special HugeTLB page sizes along with
> >>> the generic ones (PMD|PUD|PGD) would require identifying all of them on a
> >>> given platform. A platform specific hook can precisely enumerate all huge
> >>> page sizes supported for migration. Instead of comparing against standard
> >>> huge page orders let hugetlb_migration_support() function call a platform
> >>> hook arch_hugetlb_migration_support(). Default definition for the platform
> >>> hook maintains existing semantics which checks standard huge page order.
> >>> But an architecture can choose to override the default and provide support
> >>> for a comprehensive set of huge page sizes.
> >>>
> >>> Reviewed-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
> >>> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
> >>
> >> Acked-by: Michal Hocko <mhocko@use.com>
> > 
> > fat fingers here, should be mhocko@suse.com of course.
> 
> Sure no problems. As we had discussed earlier and agreed to keep the previous
> patch "mm/hugetlb: Enable PUD level huge page migration" separate and not fold
> into this one, I will assume your ACK on it as well unless your disagree.

OK with me.

-- 
Michal Hocko
SUSE Labs

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH V3 1/5] mm/hugetlb: Distinguish between migratability and movability
  2018-10-23 13:01 ` [PATCH V3 1/5] mm/hugetlb: Distinguish between migratability and movability Anshuman Khandual
  2018-10-24 13:54   ` Michal Hocko
@ 2018-11-08 10:33   ` Steve Capper
  1 sibling, 0 replies; 19+ messages in thread
From: Steve Capper @ 2018-11-08 10:33 UTC (permalink / raw)
  To: Anshuman Khandual
  Cc: linux-mm, linux-arm-kernel, linux-kernel, Suzuki Poulose,
	Punit Agrawal, Will Deacon, Steven Price, Catalin Marinas,
	mhocko, akpm, mike.kravetz, n-horiguchi, nd

Hi Anshuman,

On Tue, Oct 23, 2018 at 06:31:57PM +0530, Anshuman Khandual wrote:
> During huge page allocation it's migratability is checked to determine if
> it should be placed under movable zones with GFP_HIGHUSER_MOVABLE. But the
> movability aspect of the huge page could depend on other factors than just
> migratability. Movability in itself is a distinct property which should not
> be tied with migratability alone.
> 
> This differentiates these two and implements an enhanced movability check
> which also considers huge page size to determine if it is feasible to be
> placed under a movable zone. At present it just checks for gigantic pages
> but going forward it can incorporate other enhanced checks.
> 
> Reviewed-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
> Suggested-by: Michal Hocko <mhocko@kernel.org>
> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>

FWIW:
Reviewed-by: Steve Capper <steve.capper@arm.com>

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH V3 2/5] mm/hugetlb: Enable PUD level huge page migration
  2018-10-23 13:01 ` [PATCH V3 2/5] mm/hugetlb: Enable PUD level huge page migration Anshuman Khandual
@ 2018-11-08 10:34   ` Steve Capper
  0 siblings, 0 replies; 19+ messages in thread
From: Steve Capper @ 2018-11-08 10:34 UTC (permalink / raw)
  To: Anshuman Khandual
  Cc: linux-mm, linux-arm-kernel, linux-kernel, Suzuki Poulose,
	Punit Agrawal, Will Deacon, Steven Price, Catalin Marinas,
	mhocko, akpm, mike.kravetz, n-horiguchi, nd

On Tue, Oct 23, 2018 at 06:31:58PM +0530, Anshuman Khandual wrote:
> Architectures like arm64 have PUD level HugeTLB pages for certain configs
> (1GB huge page is PUD based on ARM64_4K_PAGES base page size) that can be
> enabled for migration. It can be achieved through checking for PUD_SHIFT
> order based HugeTLB pages during migration.
> 
> Reviewed-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>

Reviewed-by: Steve Capper <steve.capper@arm.com>

> ---
>  include/linux/hugetlb.h | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
> index 1b858d7..70bcd89 100644
> --- a/include/linux/hugetlb.h
> +++ b/include/linux/hugetlb.h
> @@ -497,7 +497,8 @@ static inline bool hugepage_migration_supported(struct hstate *h)
>  {
>  #ifdef CONFIG_ARCH_ENABLE_HUGEPAGE_MIGRATION
>  	if ((huge_page_shift(h) == PMD_SHIFT) ||
> -		(huge_page_shift(h) == PGDIR_SHIFT))
> +		(huge_page_shift(h) == PUD_SHIFT) ||
> +			(huge_page_shift(h) == PGDIR_SHIFT))
>  		return true;
>  	else
>  		return false;
> -- 
> 2.7.4
> 

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH V3 3/5] mm/hugetlb: Enable arch specific huge page size support for migration
  2018-10-23 13:01 ` [PATCH V3 3/5] mm/hugetlb: Enable arch specific huge page size support for migration Anshuman Khandual
  2018-10-24 13:56   ` Michal Hocko
@ 2018-11-08 10:35   ` Steve Capper
  1 sibling, 0 replies; 19+ messages in thread
From: Steve Capper @ 2018-11-08 10:35 UTC (permalink / raw)
  To: Anshuman Khandual
  Cc: linux-mm, linux-arm-kernel, linux-kernel, Suzuki Poulose,
	Punit Agrawal, Will Deacon, Steven Price, Catalin Marinas,
	mhocko, akpm, mike.kravetz, n-horiguchi, nd

On Tue, Oct 23, 2018 at 06:31:59PM +0530, Anshuman Khandual wrote:
> Architectures like arm64 have HugeTLB page sizes which are different than
> generic sizes at PMD, PUD, PGD level and implemented via contiguous bits.
> At present these special size HugeTLB pages cannot be identified through
> macros like (PMD|PUD|PGDIR)_SHIFT and hence chosen not be migrated.
> 
> Enabling migration support for these special HugeTLB page sizes along with
> the generic ones (PMD|PUD|PGD) would require identifying all of them on a
> given platform. A platform specific hook can precisely enumerate all huge
> page sizes supported for migration. Instead of comparing against standard
> huge page orders let hugetlb_migration_support() function call a platform
> hook arch_hugetlb_migration_support(). Default definition for the platform
> hook maintains existing semantics which checks standard huge page order.
> But an architecture can choose to override the default and provide support
> for a comprehensive set of huge page sizes.
> 
> Reviewed-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>

Reviewed-by: Steve Capper <steve.capper@arm.com>

> ---
>  include/linux/hugetlb.h | 15 +++++++++++++--
>  1 file changed, 13 insertions(+), 2 deletions(-)
> 
> diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
> index 70bcd89..4cc3871 100644
> --- a/include/linux/hugetlb.h
> +++ b/include/linux/hugetlb.h
> @@ -493,18 +493,29 @@ static inline pgoff_t basepage_index(struct page *page)
>  extern int dissolve_free_huge_page(struct page *page);
>  extern int dissolve_free_huge_pages(unsigned long start_pfn,
>  				    unsigned long end_pfn);
> -static inline bool hugepage_migration_supported(struct hstate *h)
> -{
> +
>  #ifdef CONFIG_ARCH_ENABLE_HUGEPAGE_MIGRATION
> +#ifndef arch_hugetlb_migration_supported
> +static inline bool arch_hugetlb_migration_supported(struct hstate *h)
> +{
>  	if ((huge_page_shift(h) == PMD_SHIFT) ||
>  		(huge_page_shift(h) == PUD_SHIFT) ||
>  			(huge_page_shift(h) == PGDIR_SHIFT))
>  		return true;
>  	else
>  		return false;
> +}
> +#endif
>  #else
> +static inline bool arch_hugetlb_migration_supported(struct hstate *h)
> +{
>  	return false;
> +}
>  #endif
> +
> +static inline bool hugepage_migration_supported(struct hstate *h)
> +{
> +	return arch_hugetlb_migration_supported(h);
>  }
>  
>  /*
> -- 
> 2.7.4
> 

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH V3 4/5] arm64/mm: Enable HugeTLB migration
  2018-10-23 13:02 ` [PATCH V3 4/5] arm64/mm: Enable HugeTLB migration Anshuman Khandual
@ 2018-11-08 10:35   ` Steve Capper
  2018-11-23 14:42   ` Catalin Marinas
  1 sibling, 0 replies; 19+ messages in thread
From: Steve Capper @ 2018-11-08 10:35 UTC (permalink / raw)
  To: Anshuman Khandual
  Cc: linux-mm, linux-arm-kernel, linux-kernel, Suzuki Poulose,
	Punit Agrawal, Will Deacon, Steven Price, Catalin Marinas,
	mhocko, akpm, mike.kravetz, n-horiguchi, nd

On Tue, Oct 23, 2018 at 06:32:00PM +0530, Anshuman Khandual wrote:
> Let arm64 subscribe to generic HugeTLB page migration framework. Right now
> this only works on the following PMD and PUD level HugeTLB page sizes with
> various kernel base page size combinations.
> 
>        CONT PTE    PMD    CONT PMD    PUD
>        --------    ---    --------    ---
> 4K:         NA     2M         NA      1G
> 16K:        NA    32M         NA
> 64K:        NA   512M         NA
> 
> Reviewed-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>


Reviewed-by: Steve Capper <steve.capper@arm.com>

> ---
>  arch/arm64/Kconfig | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
> index a8ae30f..4b3e269 100644
> --- a/arch/arm64/Kconfig
> +++ b/arch/arm64/Kconfig
> @@ -1331,6 +1331,10 @@ config SYSVIPC_COMPAT
>  	def_bool y
>  	depends on COMPAT && SYSVIPC
>  
> +config ARCH_ENABLE_HUGEPAGE_MIGRATION
> +	def_bool y
> +	depends on HUGETLB_PAGE && MIGRATION
> +
>  menu "Power management options"
>  
>  source "kernel/power/Kconfig"
> -- 
> 2.7.4
> 

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH V3 5/5] arm64/mm: Enable HugeTLB migration for contiguous bit HugeTLB pages
  2018-10-23 13:02 ` [PATCH V3 5/5] arm64/mm: Enable HugeTLB migration for contiguous bit HugeTLB pages Anshuman Khandual
@ 2018-11-08 10:36   ` Steve Capper
  2018-11-23 14:42   ` Catalin Marinas
  1 sibling, 0 replies; 19+ messages in thread
From: Steve Capper @ 2018-11-08 10:36 UTC (permalink / raw)
  To: Anshuman Khandual
  Cc: linux-mm, linux-arm-kernel, linux-kernel, Suzuki Poulose,
	Punit Agrawal, Will Deacon, Steven Price, Catalin Marinas,
	mhocko, akpm, mike.kravetz, n-horiguchi, nd

On Tue, Oct 23, 2018 at 06:32:01PM +0530, Anshuman Khandual wrote:
> Let arm64 subscribe to the previously added framework in which architecture
> can inform whether a given huge page size is supported for migration. This
> just overrides the default function arch_hugetlb_migration_supported() and
> enables migration for all possible HugeTLB page sizes on arm64. With this,
> HugeTLB migration support on arm64 now covers all possible HugeTLB options.
> 
>         CONT PTE    PMD    CONT PMD    PUD
>         --------    ---    --------    ---
> 4K:        64K      2M        32M      1G
> 16K:        2M     32M         1G
> 64K:        2M    512M        16G
> 
> Reviewed-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>

Reviewed-by: Steve Capper <steve.capper@arm.com>

> ---
>  arch/arm64/include/asm/hugetlb.h |  5 +++++
>  arch/arm64/mm/hugetlbpage.c      | 20 ++++++++++++++++++++
>  2 files changed, 25 insertions(+)
> 
> diff --git a/arch/arm64/include/asm/hugetlb.h b/arch/arm64/include/asm/hugetlb.h
> index e73f685..656f70e 100644
> --- a/arch/arm64/include/asm/hugetlb.h
> +++ b/arch/arm64/include/asm/hugetlb.h
> @@ -20,6 +20,11 @@
>  
>  #include <asm/page.h>
>  
> +#ifdef CONFIG_ARCH_ENABLE_HUGEPAGE_MIGRATION
> +#define arch_hugetlb_migration_supported arch_hugetlb_migration_supported
> +extern bool arch_hugetlb_migration_supported(struct hstate *h);
> +#endif
> +
>  static inline pte_t huge_ptep_get(pte_t *ptep)
>  {
>  	return READ_ONCE(*ptep);
> diff --git a/arch/arm64/mm/hugetlbpage.c b/arch/arm64/mm/hugetlbpage.c
> index 21512ca..f3afdcf 100644
> --- a/arch/arm64/mm/hugetlbpage.c
> +++ b/arch/arm64/mm/hugetlbpage.c
> @@ -27,6 +27,26 @@
>  #include <asm/tlbflush.h>
>  #include <asm/pgalloc.h>
>  
> +#ifdef CONFIG_ARCH_ENABLE_HUGEPAGE_MIGRATION
> +bool arch_hugetlb_migration_supported(struct hstate *h)
> +{
> +	size_t pagesize = huge_page_size(h);
> +
> +	switch (pagesize) {
> +#ifdef CONFIG_ARM64_4K_PAGES
> +	case PUD_SIZE:
> +#endif
> +	case PMD_SIZE:
> +	case CONT_PMD_SIZE:
> +	case CONT_PTE_SIZE:
> +		return true;
> +	}
> +	pr_warn("%s: unrecognized huge page size 0x%lx\n",
> +			__func__, pagesize);
> +	return false;
> +}
> +#endif
> +
>  int pmd_huge(pmd_t pmd)
>  {
>  	return pmd_val(pmd) && !(pmd_val(pmd) & PMD_TABLE_BIT);
> -- 
> 2.7.4
> 

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH V3 4/5] arm64/mm: Enable HugeTLB migration
  2018-10-23 13:02 ` [PATCH V3 4/5] arm64/mm: Enable HugeTLB migration Anshuman Khandual
  2018-11-08 10:35   ` Steve Capper
@ 2018-11-23 14:42   ` Catalin Marinas
  1 sibling, 0 replies; 19+ messages in thread
From: Catalin Marinas @ 2018-11-23 14:42 UTC (permalink / raw)
  To: Anshuman Khandual
  Cc: linux-mm, linux-arm-kernel, linux-kernel, steve.capper,
	punit.agrawal, will.deacon, Steven.Price, akpm, mhocko,
	n-horiguchi, suzuki.poulose, mike.kravetz

On Tue, Oct 23, 2018 at 06:32:00PM +0530, Anshuman Khandual wrote:
> Let arm64 subscribe to generic HugeTLB page migration framework. Right now
> this only works on the following PMD and PUD level HugeTLB page sizes with
> various kernel base page size combinations.
> 
>        CONT PTE    PMD    CONT PMD    PUD
>        --------    ---    --------    ---
> 4K:         NA     2M         NA      1G
> 16K:        NA    32M         NA
> 64K:        NA   512M         NA
> 
> Reviewed-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>

Acked-by: Catalin Marinas <catalin.marinas@arm.com>

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH V3 5/5] arm64/mm: Enable HugeTLB migration for contiguous bit HugeTLB pages
  2018-10-23 13:02 ` [PATCH V3 5/5] arm64/mm: Enable HugeTLB migration for contiguous bit HugeTLB pages Anshuman Khandual
  2018-11-08 10:36   ` Steve Capper
@ 2018-11-23 14:42   ` Catalin Marinas
  1 sibling, 0 replies; 19+ messages in thread
From: Catalin Marinas @ 2018-11-23 14:42 UTC (permalink / raw)
  To: Anshuman Khandual
  Cc: linux-mm, linux-arm-kernel, linux-kernel, steve.capper,
	punit.agrawal, will.deacon, Steven.Price, akpm, mhocko,
	n-horiguchi, suzuki.poulose, mike.kravetz

On Tue, Oct 23, 2018 at 06:32:01PM +0530, Anshuman Khandual wrote:
> Let arm64 subscribe to the previously added framework in which architecture
> can inform whether a given huge page size is supported for migration. This
> just overrides the default function arch_hugetlb_migration_supported() and
> enables migration for all possible HugeTLB page sizes on arm64. With this,
> HugeTLB migration support on arm64 now covers all possible HugeTLB options.
> 
>         CONT PTE    PMD    CONT PMD    PUD
>         --------    ---    --------    ---
> 4K:        64K      2M        32M      1G
> 16K:        2M     32M         1G
> 64K:        2M    512M        16G
> 
> Reviewed-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>

Acked-by: Catalin Marinas <catalin.marinas@arm.com>

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH V3 0/5] arm64/mm: Enable HugeTLB migration
  2018-10-23 13:01 [PATCH V3 0/5] arm64/mm: Enable HugeTLB migration Anshuman Khandual
                   ` (4 preceding siblings ...)
  2018-10-23 13:02 ` [PATCH V3 5/5] arm64/mm: Enable HugeTLB migration for contiguous bit HugeTLB pages Anshuman Khandual
@ 2018-11-23 15:08 ` Anshuman Khandual
  5 siblings, 0 replies; 19+ messages in thread
From: Anshuman Khandual @ 2018-11-23 15:08 UTC (permalink / raw)
  To: linux-mm, linux-arm-kernel, linux-kernel
  Cc: suzuki.poulose, punit.agrawal, will.deacon, Steven.Price,
	steve.capper, catalin.marinas, mhocko, akpm, mike.kravetz,
	n-horiguchi, Michal Hocko, Steve Capper



On 10/23/2018 06:31 PM, Anshuman Khandual wrote:
> This patch series enables HugeTLB migration support for all supported
> huge page sizes at all levels including contiguous bit implementation.
> Following HugeTLB migration support matrix has been enabled with this
> patch series. All permutations have been tested except for the 16GB.
> 
>          CONT PTE    PMD    CONT PMD    PUD
>          --------    ---    --------    ---
> 4K:         64K     2M         32M     1G
> 16K:         2M    32M          1G
> 64K:         2M   512M         16G
> 
> First the series adds migration support for PUD based huge pages. It
> then adds a platform specific hook to query an architecture if a
> given huge page size is supported for migration while also providing
> a default fallback option preserving the existing semantics which just
> checks for (PMD|PUD|PGDIR)_SHIFT macros. The last two patches enables
> HugeTLB migration on arm64 and subscribe to this new platform specific
> hook by defining an override.
> 
> The second patch differentiates between movability and migratability
> aspects of huge pages and implements hugepage_movable_supported() which
> can then be used during allocation to decide whether to place the huge
> page in movable zone or not.
> 
> Changes in V3:
> 
> - Re-ordered patches 1 and 2 per Michal
> - s/Movability/Migratability/ in unmap_and_move_huge_page() per Naoya
> 
> Changes in V2: (https://lkml.org/lkml/2018/10/12/190)
> 
> - Added a new patch which differentiates migratability and movability
>   of huge pages and implements hugepage_movable_supported() function
>   as suggested by Michal Hocko.
> 
> Anshuman Khandual (5):
>   mm/hugetlb: Distinguish between migratability and movability
>   mm/hugetlb: Enable PUD level huge page migration
>   mm/hugetlb: Enable arch specific huge page size support for migration
>   arm64/mm: Enable HugeTLB migration
>   arm64/mm: Enable HugeTLB migration for contiguous bit HugeTLB pages

Hello Andrew,

This patch series has been reviewed and acked both for it's core MM and
arm64 changes. Could you please consider this series. Thank you.

- Anshuman

^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2018-11-23 15:08 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-23 13:01 [PATCH V3 0/5] arm64/mm: Enable HugeTLB migration Anshuman Khandual
2018-10-23 13:01 ` [PATCH V3 1/5] mm/hugetlb: Distinguish between migratability and movability Anshuman Khandual
2018-10-24 13:54   ` Michal Hocko
2018-11-08 10:33   ` Steve Capper
2018-10-23 13:01 ` [PATCH V3 2/5] mm/hugetlb: Enable PUD level huge page migration Anshuman Khandual
2018-11-08 10:34   ` Steve Capper
2018-10-23 13:01 ` [PATCH V3 3/5] mm/hugetlb: Enable arch specific huge page size support for migration Anshuman Khandual
2018-10-24 13:56   ` Michal Hocko
2018-10-24 13:58     ` Michal Hocko
2018-10-25  6:23       ` Anshuman Khandual
2018-10-25  7:45         ` Michal Hocko
2018-11-08 10:35   ` Steve Capper
2018-10-23 13:02 ` [PATCH V3 4/5] arm64/mm: Enable HugeTLB migration Anshuman Khandual
2018-11-08 10:35   ` Steve Capper
2018-11-23 14:42   ` Catalin Marinas
2018-10-23 13:02 ` [PATCH V3 5/5] arm64/mm: Enable HugeTLB migration for contiguous bit HugeTLB pages Anshuman Khandual
2018-11-08 10:36   ` Steve Capper
2018-11-23 14:42   ` Catalin Marinas
2018-11-23 15:08 ` [PATCH V3 0/5] arm64/mm: Enable HugeTLB migration Anshuman Khandual

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).