All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] Alternative fixes for migration
@ 2022-04-04 19:30 Matthew Wilcox (Oracle)
  2022-04-04 19:30 ` [PATCH 1/4] mm/migrate: Use a folio in alloc_migration_target() Matthew Wilcox (Oracle)
                   ` (6 more replies)
  0 siblings, 7 replies; 10+ messages in thread
From: Matthew Wilcox (Oracle) @ 2022-04-04 19:30 UTC (permalink / raw)
  To: linux-mm, Andrew Morton, Zi Yan; +Cc: Matthew Wilcox (Oracle)

I heartily endorse Zi Yan's minimal fixes.  These patches, drawn from
my development tree and with absolutely no testing, are a different
approach to fixing the problem.  I would have submitted these patches
earlier if I'd known they were needed.

I think migrate_misplaced_transhuge_page() may be missing from Zi's
patch, but maybe filesystem pages can't end up in that path?  Anyway,
let me know if you like these patches better.

Matthew Wilcox (Oracle) (4):
  mm/migrate: Use a folio in alloc_migration_target()
  mm/migrate: Use a folio in migrate_misplaced_transhuge_page()
  mm: Add vma_alloc_folio()
  mm/mempolicy: Use vma_alloc_folio() in new_page()

 include/linux/gfp.h |  8 +++--
 mm/mempolicy.c      | 38 +++++++++++++--------
 mm/migrate.c        | 80 +++++++++++++++------------------------------
 3 files changed, 56 insertions(+), 70 deletions(-)

-- 
2.34.1



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

* [PATCH 1/4] mm/migrate: Use a folio in alloc_migration_target()
  2022-04-04 19:30 [PATCH 0/4] Alternative fixes for migration Matthew Wilcox (Oracle)
@ 2022-04-04 19:30 ` Matthew Wilcox (Oracle)
  2022-04-04 19:30 ` [PATCH 2/4] mm/migrate: Use a folio in migrate_misplaced_transhuge_page() Matthew Wilcox (Oracle)
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: Matthew Wilcox (Oracle) @ 2022-04-04 19:30 UTC (permalink / raw)
  To: linux-mm, Andrew Morton, Zi Yan; +Cc: Matthew Wilcox (Oracle)

This removes an assumption that a large folio is HPAGE_PMD_ORDER
as well as letting us remove the call to prep_transhuge_page()
and a few hidden calls to compound_head().

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 mm/migrate.c | 22 ++++++++++------------
 1 file changed, 10 insertions(+), 12 deletions(-)

diff --git a/mm/migrate.c b/mm/migrate.c
index de175e2fdba5..9894e90db006 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -1520,10 +1520,11 @@ int migrate_pages(struct list_head *from, new_page_t get_new_page,
 
 struct page *alloc_migration_target(struct page *page, unsigned long private)
 {
+	struct folio *folio = page_folio(page);
 	struct migration_target_control *mtc;
 	gfp_t gfp_mask;
 	unsigned int order = 0;
-	struct page *new_page = NULL;
+	struct folio *new_folio = NULL;
 	int nid;
 	int zidx;
 
@@ -1531,34 +1532,31 @@ struct page *alloc_migration_target(struct page *page, unsigned long private)
 	gfp_mask = mtc->gfp_mask;
 	nid = mtc->nid;
 	if (nid == NUMA_NO_NODE)
-		nid = page_to_nid(page);
+		nid = folio_nid(folio);
 
-	if (PageHuge(page)) {
-		struct hstate *h = page_hstate(compound_head(page));
+	if (folio_test_hugetlb(folio)) {
+		struct hstate *h = page_hstate(&folio->page);
 
 		gfp_mask = htlb_modify_alloc_mask(h, gfp_mask);
 		return alloc_huge_page_nodemask(h, nid, mtc->nmask, gfp_mask);
 	}
 
-	if (PageTransHuge(page)) {
+	if (folio_test_large(folio)) {
 		/*
 		 * clear __GFP_RECLAIM to make the migration callback
 		 * consistent with regular THP allocations.
 		 */
 		gfp_mask &= ~__GFP_RECLAIM;
 		gfp_mask |= GFP_TRANSHUGE;
-		order = HPAGE_PMD_ORDER;
+		order = folio_order(folio);
 	}
-	zidx = zone_idx(page_zone(page));
+	zidx = zone_idx(folio_zone(folio));
 	if (is_highmem_idx(zidx) || zidx == ZONE_MOVABLE)
 		gfp_mask |= __GFP_HIGHMEM;
 
-	new_page = __alloc_pages(gfp_mask, order, nid, mtc->nmask);
-
-	if (new_page && PageTransHuge(new_page))
-		prep_transhuge_page(new_page);
+	new_folio = __folio_alloc(gfp_mask, order, nid, mtc->nmask);
 
-	return new_page;
+	return &new_folio->page;
 }
 
 #ifdef CONFIG_NUMA
-- 
2.34.1



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

* [PATCH 2/4] mm/migrate: Use a folio in migrate_misplaced_transhuge_page()
  2022-04-04 19:30 [PATCH 0/4] Alternative fixes for migration Matthew Wilcox (Oracle)
  2022-04-04 19:30 ` [PATCH 1/4] mm/migrate: Use a folio in alloc_migration_target() Matthew Wilcox (Oracle)
@ 2022-04-04 19:30 ` Matthew Wilcox (Oracle)
  2022-04-04 19:30 ` [PATCH 3/4] mm: Add vma_alloc_folio() Matthew Wilcox (Oracle)
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: Matthew Wilcox (Oracle) @ 2022-04-04 19:30 UTC (permalink / raw)
  To: linux-mm, Andrew Morton, Zi Yan; +Cc: Matthew Wilcox (Oracle)

Unify alloc_misplaced_dst_page() and alloc_misplaced_dst_page_thp().
Removes an assumption that compound pages are either order 0 or
HPAGE_PMD_ORDER.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 mm/migrate.c | 58 +++++++++++++++-------------------------------------
 1 file changed, 16 insertions(+), 42 deletions(-)

diff --git a/mm/migrate.c b/mm/migrate.c
index 9894e90db006..6c31ee1e1c9b 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -1997,32 +1997,20 @@ static struct page *alloc_misplaced_dst_page(struct page *page,
 					   unsigned long data)
 {
 	int nid = (int) data;
-	struct page *newpage;
-
-	newpage = __alloc_pages_node(nid,
-					 (GFP_HIGHUSER_MOVABLE |
-					  __GFP_THISNODE | __GFP_NOMEMALLOC |
-					  __GFP_NORETRY | __GFP_NOWARN) &
-					 ~__GFP_RECLAIM, 0);
-
-	return newpage;
-}
-
-static struct page *alloc_misplaced_dst_page_thp(struct page *page,
-						 unsigned long data)
-{
-	int nid = (int) data;
-	struct page *newpage;
-
-	newpage = alloc_pages_node(nid, (GFP_TRANSHUGE_LIGHT | __GFP_THISNODE),
-				   HPAGE_PMD_ORDER);
-	if (!newpage)
-		goto out;
-
-	prep_transhuge_page(newpage);
+	int order = compound_order(page);
+	gfp_t gfp = __GFP_THISNODE;
+	struct folio *new;
+
+	if (order > 0)
+		gfp |= GFP_TRANSHUGE_LIGHT;
+	else {
+		gfp |= GFP_HIGHUSER_MOVABLE | __GFP_NOMEMALLOC | __GFP_NORETRY |
+			__GFP_NOWARN;
+		gfp &= ~__GFP_RECLAIM;
+	}
+	new = __folio_alloc_node(gfp, order, nid);
 
-out:
-	return newpage;
+	return &new->page;
 }
 
 static int numamigrate_isolate_page(pg_data_t *pgdat, struct page *page)
@@ -2080,22 +2068,8 @@ int migrate_misplaced_page(struct page *page, struct vm_area_struct *vma,
 	int nr_remaining;
 	unsigned int nr_succeeded;
 	LIST_HEAD(migratepages);
-	new_page_t *new;
-	bool compound;
 	int nr_pages = thp_nr_pages(page);
 
-	/*
-	 * PTE mapped THP or HugeTLB page can't reach here so the page could
-	 * be either base page or THP.  And it must be head page if it is
-	 * THP.
-	 */
-	compound = PageTransHuge(page);
-
-	if (compound)
-		new = alloc_misplaced_dst_page_thp;
-	else
-		new = alloc_misplaced_dst_page;
-
 	/*
 	 * Don't migrate file pages that are mapped in multiple processes
 	 * with execute permissions as they are probably shared libraries.
@@ -2116,9 +2090,9 @@ int migrate_misplaced_page(struct page *page, struct vm_area_struct *vma,
 		goto out;
 
 	list_add(&page->lru, &migratepages);
-	nr_remaining = migrate_pages(&migratepages, *new, NULL, node,
-				     MIGRATE_ASYNC, MR_NUMA_MISPLACED,
-				     &nr_succeeded);
+	nr_remaining = migrate_pages(&migratepages, alloc_misplaced_dst_page,
+				     NULL, node, MIGRATE_ASYNC,
+				     MR_NUMA_MISPLACED, &nr_succeeded);
 	if (nr_remaining) {
 		if (!list_empty(&migratepages)) {
 			list_del(&page->lru);
-- 
2.34.1



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

* [PATCH 3/4] mm: Add vma_alloc_folio()
  2022-04-04 19:30 [PATCH 0/4] Alternative fixes for migration Matthew Wilcox (Oracle)
  2022-04-04 19:30 ` [PATCH 1/4] mm/migrate: Use a folio in alloc_migration_target() Matthew Wilcox (Oracle)
  2022-04-04 19:30 ` [PATCH 2/4] mm/migrate: Use a folio in migrate_misplaced_transhuge_page() Matthew Wilcox (Oracle)
@ 2022-04-04 19:30 ` Matthew Wilcox (Oracle)
  2022-04-04 19:30 ` [PATCH 4/4] mm/mempolicy: Use vma_alloc_folio() in new_page() Matthew Wilcox (Oracle)
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: Matthew Wilcox (Oracle) @ 2022-04-04 19:30 UTC (permalink / raw)
  To: linux-mm, Andrew Morton, Zi Yan; +Cc: Matthew Wilcox (Oracle)

This wrapper around alloc_pages_vma() calls prep_transhuge_page(),
removing the obligation from the caller.  This is in the same spirit
as __folio_alloc().

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 include/linux/gfp.h |  8 ++++++--
 mm/mempolicy.c      | 13 +++++++++++++
 2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/include/linux/gfp.h b/include/linux/gfp.h
index 761f8f1885c7..3e3d36fc2109 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -613,9 +613,11 @@ static inline struct page *alloc_pages_node(int nid, gfp_t gfp_mask,
 #ifdef CONFIG_NUMA
 struct page *alloc_pages(gfp_t gfp, unsigned int order);
 struct folio *folio_alloc(gfp_t gfp, unsigned order);
-extern struct page *alloc_pages_vma(gfp_t gfp_mask, int order,
+struct page *alloc_pages_vma(gfp_t gfp_mask, int order,
 			struct vm_area_struct *vma, unsigned long addr,
 			bool hugepage);
+struct folio *vma_alloc_folio(gfp_t gfp, int order, struct vm_area_struct *vma,
+		unsigned long addr, bool hugepage);
 #define alloc_hugepage_vma(gfp_mask, vma, addr, order) \
 	alloc_pages_vma(gfp_mask, order, vma, addr, true)
 #else
@@ -627,8 +629,10 @@ static inline struct folio *folio_alloc(gfp_t gfp, unsigned int order)
 {
 	return __folio_alloc_node(gfp, order, numa_node_id());
 }
-#define alloc_pages_vma(gfp_mask, order, vma, addr, false)\
+#define alloc_pages_vma(gfp_mask, order, vma, addr, hugepage) \
 	alloc_pages(gfp_mask, order)
+#define vma_alloc_folio(gfp, order, vma, addr, hugepage)		\
+	folio_alloc(gfp, order)
 #define alloc_hugepage_vma(gfp_mask, vma, addr, order) \
 	alloc_pages(gfp_mask, order)
 #endif
diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index a2516d31db6c..ec15f4f4b714 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -2227,6 +2227,19 @@ struct page *alloc_pages_vma(gfp_t gfp, int order, struct vm_area_struct *vma,
 }
 EXPORT_SYMBOL(alloc_pages_vma);
 
+struct folio *vma_alloc_folio(gfp_t gfp, int order, struct vm_area_struct *vma,
+		unsigned long addr, bool hugepage)
+{
+	struct folio *folio;
+
+	folio = (struct folio *)alloc_pages_vma(gfp, order, vma, addr,
+			hugepage);
+	if (folio && order > 1)
+		prep_transhuge_page(&folio->page);
+
+	return folio;
+}
+
 /**
  * alloc_pages - Allocate pages.
  * @gfp: GFP flags.
-- 
2.34.1



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

* [PATCH 4/4] mm/mempolicy: Use vma_alloc_folio() in new_page()
  2022-04-04 19:30 [PATCH 0/4] Alternative fixes for migration Matthew Wilcox (Oracle)
                   ` (2 preceding siblings ...)
  2022-04-04 19:30 ` [PATCH 3/4] mm: Add vma_alloc_folio() Matthew Wilcox (Oracle)
@ 2022-04-04 19:30 ` Matthew Wilcox (Oracle)
  2022-04-04 19:51   ` Zi Yan
  2022-04-04 19:53 ` [PATCH 0/4] Alternative fixes for migration Zi Yan
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 10+ messages in thread
From: Matthew Wilcox (Oracle) @ 2022-04-04 19:30 UTC (permalink / raw)
  To: linux-mm, Andrew Morton, Zi Yan; +Cc: Matthew Wilcox (Oracle)

Simplify new_page() by unifying the THP and base page cases, and
handle orders other than 0 and HPAGE_PMD_ORDER correctly.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 mm/mempolicy.c | 25 +++++++++++--------------
 1 file changed, 11 insertions(+), 14 deletions(-)

diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index ec15f4f4b714..d6d7a95b0cce 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -1191,8 +1191,10 @@ int do_migrate_pages(struct mm_struct *mm, const nodemask_t *from,
  */
 static struct page *new_page(struct page *page, unsigned long start)
 {
+	struct folio *dst, *src = page_folio(page);
 	struct vm_area_struct *vma;
 	unsigned long address;
+	gfp_t gfp = GFP_HIGHUSER_MOVABLE | __GFP_RETRY_MAYFAIL;
 
 	vma = find_vma(current->mm, start);
 	while (vma) {
@@ -1202,24 +1204,19 @@ static struct page *new_page(struct page *page, unsigned long start)
 		vma = vma->vm_next;
 	}
 
-	if (PageHuge(page)) {
-		return alloc_huge_page_vma(page_hstate(compound_head(page)),
+	if (folio_test_hugetlb(src)) {
+		return alloc_huge_page_vma(page_hstate(&src->page),
 				vma, address);
-	} else if (PageTransHuge(page)) {
-		struct page *thp;
-
-		thp = alloc_hugepage_vma(GFP_TRANSHUGE, vma, address,
-					 HPAGE_PMD_ORDER);
-		if (!thp)
-			return NULL;
-		prep_transhuge_page(thp);
-		return thp;
+	} else if (folio_test_large(src)) {
+		gfp = GFP_TRANSHUGE;
 	}
+
 	/*
-	 * if !vma, alloc_page_vma() will use task or system default policy
+	 * if !vma, vma_alloc_folio() will use task or system default policy
 	 */
-	return alloc_page_vma(GFP_HIGHUSER_MOVABLE | __GFP_RETRY_MAYFAIL,
-			vma, address);
+	dst = vma_alloc_folio(gfp, folio_order(src), vma, address,
+			folio_test_large(src));
+	return &dst->page;
 }
 #else
 
-- 
2.34.1



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

* Re: [PATCH 4/4] mm/mempolicy: Use vma_alloc_folio() in new_page()
  2022-04-04 19:30 ` [PATCH 4/4] mm/mempolicy: Use vma_alloc_folio() in new_page() Matthew Wilcox (Oracle)
@ 2022-04-04 19:51   ` Zi Yan
  2022-04-07 13:11     ` Matthew Wilcox
  0 siblings, 1 reply; 10+ messages in thread
From: Zi Yan @ 2022-04-04 19:51 UTC (permalink / raw)
  To: Matthew Wilcox (Oracle); +Cc: linux-mm, Andrew Morton

[-- Attachment #1: Type: text/plain, Size: 2096 bytes --]

On 4 Apr 2022, at 15:30, Matthew Wilcox (Oracle) wrote:

> Simplify new_page() by unifying the THP and base page cases, and
> handle orders other than 0 and HPAGE_PMD_ORDER correctly.
>
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
> ---
>  mm/mempolicy.c | 25 +++++++++++--------------
>  1 file changed, 11 insertions(+), 14 deletions(-)
>
> diff --git a/mm/mempolicy.c b/mm/mempolicy.c
> index ec15f4f4b714..d6d7a95b0cce 100644
> --- a/mm/mempolicy.c
> +++ b/mm/mempolicy.c
> @@ -1191,8 +1191,10 @@ int do_migrate_pages(struct mm_struct *mm, const nodemask_t *from,
>   */
>  static struct page *new_page(struct page *page, unsigned long start)
>  {
> +	struct folio *dst, *src = page_folio(page);
>  	struct vm_area_struct *vma;
>  	unsigned long address;
> +	gfp_t gfp = GFP_HIGHUSER_MOVABLE | __GFP_RETRY_MAYFAIL;
>
>  	vma = find_vma(current->mm, start);
>  	while (vma) {
> @@ -1202,24 +1204,19 @@ static struct page *new_page(struct page *page, unsigned long start)
>  		vma = vma->vm_next;
>  	}
>
> -	if (PageHuge(page)) {
> -		return alloc_huge_page_vma(page_hstate(compound_head(page)),
> +	if (folio_test_hugetlb(src)) {
> +		return alloc_huge_page_vma(page_hstate(&src->page),
>  				vma, address);
> -	} else if (PageTransHuge(page)) {
> -		struct page *thp;
> -
> -		thp = alloc_hugepage_vma(GFP_TRANSHUGE, vma, address,
> -					 HPAGE_PMD_ORDER);
> -		if (!thp)
> -			return NULL;
> -		prep_transhuge_page(thp);
> -		return thp;
> +	} else if (folio_test_large(src)) {
> +		gfp = GFP_TRANSHUGE;
>  	}

Nit. The two bracket pairs from the two ifs can be removed.

> +
>  	/*
> -	 * if !vma, alloc_page_vma() will use task or system default policy
> +	 * if !vma, vma_alloc_folio() will use task or system default policy
>  	 */
> -	return alloc_page_vma(GFP_HIGHUSER_MOVABLE | __GFP_RETRY_MAYFAIL,
> -			vma, address);
> +	dst = vma_alloc_folio(gfp, folio_order(src), vma, address,
> +			folio_test_large(src));
> +	return &dst->page;
>  }
>  #else
>
> -- 
> 2.34.1


--
Best Regards,
Yan, Zi

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 854 bytes --]

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

* Re: [PATCH 0/4] Alternative fixes for migration
  2022-04-04 19:30 [PATCH 0/4] Alternative fixes for migration Matthew Wilcox (Oracle)
                   ` (3 preceding siblings ...)
  2022-04-04 19:30 ` [PATCH 4/4] mm/mempolicy: Use vma_alloc_folio() in new_page() Matthew Wilcox (Oracle)
@ 2022-04-04 19:53 ` Zi Yan
  2022-04-07  6:14 ` William Kucharski
  2022-04-07  6:16 ` William Kucharski
  6 siblings, 0 replies; 10+ messages in thread
From: Zi Yan @ 2022-04-04 19:53 UTC (permalink / raw)
  To: Matthew Wilcox (Oracle); +Cc: linux-mm, Andrew Morton

[-- Attachment #1: Type: text/plain, Size: 1219 bytes --]

On 4 Apr 2022, at 15:30, Matthew Wilcox (Oracle) wrote:

> I heartily endorse Zi Yan's minimal fixes.  These patches, drawn from
> my development tree and with absolutely no testing, are a different
> approach to fixing the problem.  I would have submitted these patches
> earlier if I'd known they were needed.
>
> I think migrate_misplaced_transhuge_page() may be missing from Zi's
> patch, but maybe filesystem pages can't end up in that path?  Anyway,
> let me know if you like these patches better.

Yeah, I thought numa faulting only works on anonymous pages. I was
wrong.

>
> Matthew Wilcox (Oracle) (4):
>   mm/migrate: Use a folio in alloc_migration_target()
>   mm/migrate: Use a folio in migrate_misplaced_transhuge_page()
>   mm: Add vma_alloc_folio()
>   mm/mempolicy: Use vma_alloc_folio() in new_page()
>
>  include/linux/gfp.h |  8 +++--
>  mm/mempolicy.c      | 38 +++++++++++++--------
>  mm/migrate.c        | 80 +++++++++++++++------------------------------
>  3 files changed, 56 insertions(+), 70 deletions(-)
>
> -- 
> 2.34.1

The whole series looks good to me. My patch can be dropped. Thanks.

Reviewed-by: Zi Yan <ziy@nvidia.com>

--
Best Regards,
Yan, Zi

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 854 bytes --]

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

* Re: [PATCH 0/4] Alternative fixes for migration
  2022-04-04 19:30 [PATCH 0/4] Alternative fixes for migration Matthew Wilcox (Oracle)
                   ` (4 preceding siblings ...)
  2022-04-04 19:53 ` [PATCH 0/4] Alternative fixes for migration Zi Yan
@ 2022-04-07  6:14 ` William Kucharski
  2022-04-07  6:16 ` William Kucharski
  6 siblings, 0 replies; 10+ messages in thread
From: William Kucharski @ 2022-04-07  6:14 UTC (permalink / raw)
  To: Matthew Wilcox (Oracle); +Cc: linux-mm, Andrew Morton, Zi Yan

For the series:

Reviewed-by: William Kucharski <william.kucharski@oracle.com>

> On Apr 4, 2022, at 1:30 PM, Matthew Wilcox (Oracle) <willy@infradead.org> wrote:
> 
> I heartily endorse Zi Yan's minimal fixes.  These patches, drawn from
> my development tree and with absolutely no testing, are a different
> approach to fixing the problem.  I would have submitted these patches
> earlier if I'd known they were needed.
> 
> I think migrate_misplaced_transhuge_page() may be missing from Zi's
> patch, but maybe filesystem pages can't end up in that path?  Anyway,
> let me know if you like these patches better.
> 
> Matthew Wilcox (Oracle) (4):
>  mm/migrate: Use a folio in alloc_migration_target()
>  mm/migrate: Use a folio in migrate_misplaced_transhuge_page()
>  mm: Add vma_alloc_folio()
>  mm/mempolicy: Use vma_alloc_folio() in new_page()
> 
> include/linux/gfp.h |  8 +++--
> mm/mempolicy.c      | 38 +++++++++++++--------
> mm/migrate.c        | 80 +++++++++++++++------------------------------
> 3 files changed, 56 insertions(+), 70 deletions(-)
> 
> -- 
> 2.34.1
> 
> 



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

* Re: [PATCH 0/4] Alternative fixes for migration
  2022-04-04 19:30 [PATCH 0/4] Alternative fixes for migration Matthew Wilcox (Oracle)
                   ` (5 preceding siblings ...)
  2022-04-07  6:14 ` William Kucharski
@ 2022-04-07  6:16 ` William Kucharski
  6 siblings, 0 replies; 10+ messages in thread
From: William Kucharski @ 2022-04-07  6:16 UTC (permalink / raw)
  To: Matthew Wilcox (Oracle); +Cc: linux-mm, Andrew Morton, Zi Yan

Sorry for the RB from the wrong email address; mailer issue. :-)

For the series:

Reviewed-by: William Kucharski <william.kucharski@oracle.com>

> On Apr 4, 2022, at 1:30 PM, Matthew Wilcox (Oracle) <willy@infradead.org> wrote:
> 
> I heartily endorse Zi Yan's minimal fixes.  These patches, drawn from
> my development tree and with absolutely no testing, are a different
> approach to fixing the problem.  I would have submitted these patches
> earlier if I'd known they were needed.
> 
> I think migrate_misplaced_transhuge_page() may be missing from Zi's
> patch, but maybe filesystem pages can't end up in that path?  Anyway,
> let me know if you like these patches better.
> 
> Matthew Wilcox (Oracle) (4):
>  mm/migrate: Use a folio in alloc_migration_target()
>  mm/migrate: Use a folio in migrate_misplaced_transhuge_page()
>  mm: Add vma_alloc_folio()
>  mm/mempolicy: Use vma_alloc_folio() in new_page()
> 
> include/linux/gfp.h |  8 +++--
> mm/mempolicy.c      | 38 +++++++++++++--------
> mm/migrate.c        | 80 +++++++++++++++------------------------------
> 3 files changed, 56 insertions(+), 70 deletions(-)
> 
> -- 
> 2.34.1
> 
> 



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

* Re: [PATCH 4/4] mm/mempolicy: Use vma_alloc_folio() in new_page()
  2022-04-04 19:51   ` Zi Yan
@ 2022-04-07 13:11     ` Matthew Wilcox
  0 siblings, 0 replies; 10+ messages in thread
From: Matthew Wilcox @ 2022-04-07 13:11 UTC (permalink / raw)
  To: Zi Yan; +Cc: linux-mm, Andrew Morton

On Mon, Apr 04, 2022 at 03:51:30PM -0400, Zi Yan wrote:
> On 4 Apr 2022, at 15:30, Matthew Wilcox (Oracle) wrote:
> >
> > -	if (PageHuge(page)) {
> > -		return alloc_huge_page_vma(page_hstate(compound_head(page)),
> > +	if (folio_test_hugetlb(src)) {
> > +		return alloc_huge_page_vma(page_hstate(&src->page),
> >  				vma, address);
> > -	} else if (PageTransHuge(page)) {
> > -		struct page *thp;
> > -
> > -		thp = alloc_hugepage_vma(GFP_TRANSHUGE, vma, address,
> > -					 HPAGE_PMD_ORDER);
> > -		if (!thp)
> > -			return NULL;
> > -		prep_transhuge_page(thp);
> > -		return thp;
> > +	} else if (folio_test_large(src)) {
> > +		gfp = GFP_TRANSHUGE;
> >  	}
> 
> Nit. The two bracket pairs from the two ifs can be removed.

Even better, the first is a return, so it can simply be:

        if (folio_test_hugetlb(src))
                return alloc_huge_page_vma(page_hstate(&src->page),
                                vma, address);

        if (folio_test_large(src))
                gfp = GFP_TRANSHUGE;

        dst = vma_alloc_folio(gfp, folio_order(src), vma, address,
                        folio_test_large(src));




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

end of thread, other threads:[~2022-04-07 13:11 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-04 19:30 [PATCH 0/4] Alternative fixes for migration Matthew Wilcox (Oracle)
2022-04-04 19:30 ` [PATCH 1/4] mm/migrate: Use a folio in alloc_migration_target() Matthew Wilcox (Oracle)
2022-04-04 19:30 ` [PATCH 2/4] mm/migrate: Use a folio in migrate_misplaced_transhuge_page() Matthew Wilcox (Oracle)
2022-04-04 19:30 ` [PATCH 3/4] mm: Add vma_alloc_folio() Matthew Wilcox (Oracle)
2022-04-04 19:30 ` [PATCH 4/4] mm/mempolicy: Use vma_alloc_folio() in new_page() Matthew Wilcox (Oracle)
2022-04-04 19:51   ` Zi Yan
2022-04-07 13:11     ` Matthew Wilcox
2022-04-04 19:53 ` [PATCH 0/4] Alternative fixes for migration Zi Yan
2022-04-07  6:14 ` William Kucharski
2022-04-07  6:16 ` William Kucharski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.