linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V2 0/5] arm64/mm: Enable HugeTLB migration
@ 2018-10-12  3:59 Anshuman Khandual
  2018-10-12  3:59 ` [PATCH V2 1/5] mm/hugetlb: Enable PUD level huge page migration Anshuman Khandual
                   ` (5 more replies)
  0 siblings, 6 replies; 13+ messages in thread
From: Anshuman Khandual @ 2018-10-12  3:59 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 V2:

- 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: Enable PUD level huge page migration
  mm/hugetlb: Distinguish between migratability and movability
  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 +-
 5 files changed, 75 insertions(+), 4 deletions(-)

-- 
2.7.4


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

* [PATCH V2 1/5] mm/hugetlb: Enable PUD level huge page migration
  2018-10-12  3:59 [PATCH V2 0/5] arm64/mm: Enable HugeTLB migration Anshuman Khandual
@ 2018-10-12  3:59 ` Anshuman Khandual
  2018-10-19  8:09   ` Michal Hocko
  2018-10-12  3:59 ` [PATCH V2 2/5] mm/hugetlb: Distinguish between migratability and movability Anshuman Khandual
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 13+ messages in thread
From: Anshuman Khandual @ 2018-10-12  3:59 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.

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 6b68e34..9c1b77f 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -483,7 +483,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 related	[flat|nested] 13+ messages in thread

* [PATCH V2 2/5] mm/hugetlb: Distinguish between migratability and movability
  2018-10-12  3:59 [PATCH V2 0/5] arm64/mm: Enable HugeTLB migration Anshuman Khandual
  2018-10-12  3:59 ` [PATCH V2 1/5] mm/hugetlb: Enable PUD level huge page migration Anshuman Khandual
@ 2018-10-12  3:59 ` Anshuman Khandual
  2018-10-19  1:59   ` Naoya Horiguchi
  2018-10-12  3:59 ` [PATCH V2 3/5] mm/hugetlb: Enable arch specific huge page size support for migration Anshuman Khandual
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 13+ messages in thread
From: Anshuman Khandual @ 2018-10-12  3:59 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.

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 +-
 2 files changed, 31 insertions(+), 1 deletion(-)

diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index 9c1b77f..456cb60 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -493,6 +493,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)
 {
@@ -589,6 +614,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 3c21775..a5a111d 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;
-- 
2.7.4


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

* [PATCH V2 3/5] mm/hugetlb: Enable arch specific huge page size support for migration
  2018-10-12  3:59 [PATCH V2 0/5] arm64/mm: Enable HugeTLB migration Anshuman Khandual
  2018-10-12  3:59 ` [PATCH V2 1/5] mm/hugetlb: Enable PUD level huge page migration Anshuman Khandual
  2018-10-12  3:59 ` [PATCH V2 2/5] mm/hugetlb: Distinguish between migratability and movability Anshuman Khandual
@ 2018-10-12  3:59 ` Anshuman Khandual
  2018-10-12  3:59 ` [PATCH V2 4/5] arm64/mm: Enable HugeTLB migration Anshuman Khandual
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 13+ messages in thread
From: Anshuman Khandual @ 2018-10-12  3:59 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.

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 456cb60..97a2fdb 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -479,18 +479,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 related	[flat|nested] 13+ messages in thread

* [PATCH V2 4/5] arm64/mm: Enable HugeTLB migration
  2018-10-12  3:59 [PATCH V2 0/5] arm64/mm: Enable HugeTLB migration Anshuman Khandual
                   ` (2 preceding siblings ...)
  2018-10-12  3:59 ` [PATCH V2 3/5] mm/hugetlb: Enable arch specific huge page size support for migration Anshuman Khandual
@ 2018-10-12  3:59 ` Anshuman Khandual
  2018-10-12  3:59 ` [PATCH V2 5/5] arm64/mm: Enable HugeTLB migration for contiguous bit HugeTLB pages Anshuman Khandual
  2018-10-17  8:19 ` [PATCH V2 0/5] arm64/mm: Enable HugeTLB migration Anshuman Khandual
  5 siblings, 0 replies; 13+ messages in thread
From: Anshuman Khandual @ 2018-10-12  3:59 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

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 1b1a0e9..e54350f 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -1305,6 +1305,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 related	[flat|nested] 13+ messages in thread

* [PATCH V2 5/5] arm64/mm: Enable HugeTLB migration for contiguous bit HugeTLB pages
  2018-10-12  3:59 [PATCH V2 0/5] arm64/mm: Enable HugeTLB migration Anshuman Khandual
                   ` (3 preceding siblings ...)
  2018-10-12  3:59 ` [PATCH V2 4/5] arm64/mm: Enable HugeTLB migration Anshuman Khandual
@ 2018-10-12  3:59 ` Anshuman Khandual
  2018-10-17  8:19 ` [PATCH V2 0/5] arm64/mm: Enable HugeTLB migration Anshuman Khandual
  5 siblings, 0 replies; 13+ messages in thread
From: Anshuman Khandual @ 2018-10-12  3:59 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

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 4eafd9f..28f4795 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 related	[flat|nested] 13+ messages in thread

* Re: [PATCH V2 0/5] arm64/mm: Enable HugeTLB migration
  2018-10-12  3:59 [PATCH V2 0/5] arm64/mm: Enable HugeTLB migration Anshuman Khandual
                   ` (4 preceding siblings ...)
  2018-10-12  3:59 ` [PATCH V2 5/5] arm64/mm: Enable HugeTLB migration for contiguous bit HugeTLB pages Anshuman Khandual
@ 2018-10-17  8:19 ` Anshuman Khandual
  2018-10-19  2:01   ` Naoya Horiguchi
  5 siblings, 1 reply; 13+ messages in thread
From: Anshuman Khandual @ 2018-10-17  8:19 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



On 10/12/2018 09:29 AM, 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 V2:
> 
> - Added a new patch which differentiates migratability and movability
>   of huge pages and implements hugepage_movable_supported() function
>   as suggested by Michal Hocko.

Hello Andrew/Michal/Mike/Naoya/Catalin,

Just checking for an update. Does this series looks okay ?

- Anshuman

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

* Re: [PATCH V2 2/5] mm/hugetlb: Distinguish between migratability and movability
  2018-10-12  3:59 ` [PATCH V2 2/5] mm/hugetlb: Distinguish between migratability and movability Anshuman Khandual
@ 2018-10-19  1:59   ` Naoya Horiguchi
  2018-10-19  2:32     ` Anshuman Khandual
  0 siblings, 1 reply; 13+ messages in thread
From: Naoya Horiguchi @ 2018-10-19  1:59 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, mhocko, akpm, mike.kravetz

On Fri, Oct 12, 2018 at 09:29:56AM +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.

(nitpicking...)
The following code just checks hugepage_migration_supported(), so maybe
s/Movability/Migratability/ is expected in the comment?

  static int unmap_and_move_huge_page(...)
  {
          ...
          /*
           * Movability of hugepages depends on architectures and hugepage 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
           * kicking migration.
           */
          if (!hugepage_migration_supported(page_hstate(hpage))) {

Thanks,
Naoya Horiguchi

> 
> 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 +-
>  2 files changed, 31 insertions(+), 1 deletion(-)
> 
> diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
> index 9c1b77f..456cb60 100644
> --- a/include/linux/hugetlb.h
> +++ b/include/linux/hugetlb.h
> @@ -493,6 +493,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)
>  {
> @@ -589,6 +614,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 3c21775..a5a111d 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;
> -- 
> 2.7.4
> 
> 

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

* Re: [PATCH V2 0/5] arm64/mm: Enable HugeTLB migration
  2018-10-17  8:19 ` [PATCH V2 0/5] arm64/mm: Enable HugeTLB migration Anshuman Khandual
@ 2018-10-19  2:01   ` Naoya Horiguchi
  0 siblings, 0 replies; 13+ messages in thread
From: Naoya Horiguchi @ 2018-10-19  2:01 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, mhocko, akpm, mike.kravetz

On Wed, Oct 17, 2018 at 01:49:17PM +0530, Anshuman Khandual wrote:
> 
> 
> On 10/12/2018 09:29 AM, 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 V2:
> > 
> > - Added a new patch which differentiates migratability and movability
> >   of huge pages and implements hugepage_movable_supported() function
> >   as suggested by Michal Hocko.
> 
> Hello Andrew/Michal/Mike/Naoya/Catalin,
> 
> Just checking for an update. Does this series looks okay ?

Looks good to me. So for the series

Reviewed-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>

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

* Re: [PATCH V2 2/5] mm/hugetlb: Distinguish between migratability and movability
  2018-10-19  1:59   ` Naoya Horiguchi
@ 2018-10-19  2:32     ` Anshuman Khandual
  0 siblings, 0 replies; 13+ messages in thread
From: Anshuman Khandual @ 2018-10-19  2:32 UTC (permalink / raw)
  To: Naoya Horiguchi
  Cc: linux-mm, linux-arm-kernel, linux-kernel, suzuki.poulose,
	punit.agrawal, will.deacon, Steven.Price, steve.capper,
	catalin.marinas, mhocko, akpm, mike.kravetz



On 10/19/2018 07:29 AM, Naoya Horiguchi wrote:
> On Fri, Oct 12, 2018 at 09:29:56AM +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.
> 
> (nitpicking...)
> The following code just checks hugepage_migration_supported(), so maybe
> s/Movability/Migratability/ is expected in the comment?
> 
>   static int unmap_and_move_huge_page(...)
>   {
>           ...
>           /*
>            * Movability of hugepages depends on architectures and hugepage 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
>            * kicking migration.
>            */
>           if (!hugepage_migration_supported(page_hstate(hpage))) {
> 
Sure, will update this patch only unless other changes are suggested.

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

* Re: [PATCH V2 1/5] mm/hugetlb: Enable PUD level huge page migration
  2018-10-12  3:59 ` [PATCH V2 1/5] mm/hugetlb: Enable PUD level huge page migration Anshuman Khandual
@ 2018-10-19  8:09   ` Michal Hocko
  2018-10-22  3:01     ` Anshuman Khandual
  0 siblings, 1 reply; 13+ messages in thread
From: Michal Hocko @ 2018-10-19  8:09 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

I planed to get to review this earlier but been busy. Anyway, this patch
should be applied only after movability one to prevent from
(theoretical) bisectability issues.

I would probably fold it into the one which defines arch specific hook.

On Fri 12-10-18 09:29:55, 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.
> 
> 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 6b68e34..9c1b77f 100644
> --- a/include/linux/hugetlb.h
> +++ b/include/linux/hugetlb.h
> @@ -483,7 +483,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

-- 
Michal Hocko
SUSE Labs

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

* Re: [PATCH V2 1/5] mm/hugetlb: Enable PUD level huge page migration
  2018-10-19  8:09   ` Michal Hocko
@ 2018-10-22  3:01     ` Anshuman Khandual
  2018-10-22  7:16       ` Michal Hocko
  0 siblings, 1 reply; 13+ messages in thread
From: Anshuman Khandual @ 2018-10-22  3:01 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/19/2018 01:39 PM, Michal Hocko wrote:
> I planed to get to review this earlier but been busy. Anyway, this patch
> should be applied only after movability one to prevent from
> (theoretical) bisectability issues.

Sure, I can change the order there.

> 
> I would probably fold it into the one which defines arch specific hook.

Hmm but that may be like doing two functionality changes together. Adding one
more conditional check and at the same time wrapping it over with a new name
which is part of a new scheme. I would suggest keeping the patches separate.

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

* Re: [PATCH V2 1/5] mm/hugetlb: Enable PUD level huge page migration
  2018-10-22  3:01     ` Anshuman Khandual
@ 2018-10-22  7:16       ` Michal Hocko
  0 siblings, 0 replies; 13+ messages in thread
From: Michal Hocko @ 2018-10-22  7:16 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 Mon 22-10-18 08:31:05, Anshuman Khandual wrote:
> On 10/19/2018 01:39 PM, Michal Hocko wrote:
> > I would probably fold it into the one which defines arch specific hook.
> 
> Hmm but that may be like doing two functionality changes together. Adding one
> more conditional check and at the same time wrapping it over with a new name
> which is part of a new scheme. I would suggest keeping the patches separate.

I will surely not insist. If you think it is better this way then no
objections from me of course.

-- 
Michal Hocko
SUSE Labs

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

end of thread, other threads:[~2018-10-22  7:16 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-12  3:59 [PATCH V2 0/5] arm64/mm: Enable HugeTLB migration Anshuman Khandual
2018-10-12  3:59 ` [PATCH V2 1/5] mm/hugetlb: Enable PUD level huge page migration Anshuman Khandual
2018-10-19  8:09   ` Michal Hocko
2018-10-22  3:01     ` Anshuman Khandual
2018-10-22  7:16       ` Michal Hocko
2018-10-12  3:59 ` [PATCH V2 2/5] mm/hugetlb: Distinguish between migratability and movability Anshuman Khandual
2018-10-19  1:59   ` Naoya Horiguchi
2018-10-19  2:32     ` Anshuman Khandual
2018-10-12  3:59 ` [PATCH V2 3/5] mm/hugetlb: Enable arch specific huge page size support for migration Anshuman Khandual
2018-10-12  3:59 ` [PATCH V2 4/5] arm64/mm: Enable HugeTLB migration Anshuman Khandual
2018-10-12  3:59 ` [PATCH V2 5/5] arm64/mm: Enable HugeTLB migration for contiguous bit HugeTLB pages Anshuman Khandual
2018-10-17  8:19 ` [PATCH V2 0/5] arm64/mm: Enable HugeTLB migration Anshuman Khandual
2018-10-19  2:01   ` Naoya Horiguchi

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