linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/migrate: correct thp migration stats.
@ 2020-09-17 20:27 Zi Yan
  2020-09-17 20:59 ` Daniel Jordan
  0 siblings, 1 reply; 3+ messages in thread
From: Zi Yan @ 2020-09-17 20:27 UTC (permalink / raw)
  To: Andrew Morton
  Cc: linux-mm, linux-kernel, Zi Yan, Daniel Jordan, Anshuman Khandual

From: Zi Yan <ziy@nvidia.com>

PageTransHuge returns true for both thp and hugetlb, so thp stats was
counting both thp and hugetlb migrations. Exclude hugetlb migration by
setting is_thp variable right.

Fixes: 1a5bae25e3cf ("mm/vmstat: add events for THP migration without split")
Signed-off-by: Zi Yan <ziy@nvidia.com>
Cc: Daniel Jordan <daniel.m.jordan@oracle.com>
Cc: Anshuman Khandual <anshuman.khandual@arm.com>
---
 mm/migrate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/migrate.c b/mm/migrate.c
index 941b89383cf3..d1ad964165e5 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -1445,7 +1445,7 @@ int migrate_pages(struct list_head *from, new_page_t get_new_page,
 			 * Capture required information that might get lost
 			 * during migration.
 			 */
-			is_thp = PageTransHuge(page);
+			is_thp = PageTransHuge(page) && !PageHuge(page);
 			nr_subpages = thp_nr_pages(page);
 			cond_resched();
 
-- 
2.28.0


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

* Re: [PATCH] mm/migrate: correct thp migration stats.
  2020-09-17 20:59 ` Daniel Jordan
@ 2020-09-17 20:55   ` Zi Yan
  0 siblings, 0 replies; 3+ messages in thread
From: Zi Yan @ 2020-09-17 20:55 UTC (permalink / raw)
  To: Daniel Jordan; +Cc: Andrew Morton, linux-mm, linux-kernel, Anshuman Khandual

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

On 17 Sep 2020, at 16:59, Daniel Jordan wrote:

> On Thu, Sep 17, 2020 at 04:27:29PM -0400, Zi Yan wrote:
>> From: Zi Yan <ziy@nvidia.com>
>>
>> PageTransHuge returns true for both thp and hugetlb, so thp stats was
>> counting both thp and hugetlb migrations. Exclude hugetlb migration by
>> setting is_thp variable right.
>
> Yeah, shoot.
>
>> Fixes: 1a5bae25e3cf ("mm/vmstat: add events for THP migration without split")
>> Signed-off-by: Zi Yan <ziy@nvidia.com>
>
> Reviewed-by: Daniel Jordan <daniel.m.jordan@oracle.com>

Thanks.

>
> If you wanted, you could also do this.
>
> diff --git a/mm/migrate.c b/mm/migrate.c
> index d1ad964165e5..6bc9559afc70 100644
> --- a/mm/migrate.c
> +++ b/mm/migrate.c
> @@ -1471,7 +1471,7 @@ int migrate_pages(struct list_head *from, new_page_t get_new_page,
>  				 * we encounter them after the rest of the list
>  				 * is processed.
>  				 */
> -				if (PageTransHuge(page) && !PageHuge(page)) {
> +				if (is_thp) {
>  					lock_page(page);
>  					rc = split_huge_page_to_list(page, from);
>  					unlock_page(page);
> @@ -1480,8 +1480,7 @@ int migrate_pages(struct list_head *from, new_page_t get_new_page,
>  						nr_thp_split++;
>  						goto retry;
>  					}
> -				}
> -				if (is_thp) {
> +
>  					nr_thp_failed++;
>  					nr_failed += nr_subpages;
>  					goto out;

Yeah, makes sense to me. Let me send V2 to include this.

—
Best Regards,
Yan Zi

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

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

* Re: [PATCH] mm/migrate: correct thp migration stats.
  2020-09-17 20:27 [PATCH] mm/migrate: correct thp migration stats Zi Yan
@ 2020-09-17 20:59 ` Daniel Jordan
  2020-09-17 20:55   ` Zi Yan
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Jordan @ 2020-09-17 20:59 UTC (permalink / raw)
  To: Zi Yan
  Cc: Andrew Morton, linux-mm, linux-kernel, Daniel Jordan, Anshuman Khandual

On Thu, Sep 17, 2020 at 04:27:29PM -0400, Zi Yan wrote:
> From: Zi Yan <ziy@nvidia.com>
> 
> PageTransHuge returns true for both thp and hugetlb, so thp stats was
> counting both thp and hugetlb migrations. Exclude hugetlb migration by
> setting is_thp variable right.

Yeah, shoot.

> Fixes: 1a5bae25e3cf ("mm/vmstat: add events for THP migration without split")
> Signed-off-by: Zi Yan <ziy@nvidia.com>

Reviewed-by: Daniel Jordan <daniel.m.jordan@oracle.com>

If you wanted, you could also do this.

diff --git a/mm/migrate.c b/mm/migrate.c
index d1ad964165e5..6bc9559afc70 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -1471,7 +1471,7 @@ int migrate_pages(struct list_head *from, new_page_t get_new_page,
 				 * we encounter them after the rest of the list
 				 * is processed.
 				 */
-				if (PageTransHuge(page) && !PageHuge(page)) {
+				if (is_thp) {
 					lock_page(page);
 					rc = split_huge_page_to_list(page, from);
 					unlock_page(page);
@@ -1480,8 +1480,7 @@ int migrate_pages(struct list_head *from, new_page_t get_new_page,
 						nr_thp_split++;
 						goto retry;
 					}
-				}
-				if (is_thp) {
+
 					nr_thp_failed++;
 					nr_failed += nr_subpages;
 					goto out;

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

end of thread, other threads:[~2020-09-17 20:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-17 20:27 [PATCH] mm/migrate: correct thp migration stats Zi Yan
2020-09-17 20:59 ` Daniel Jordan
2020-09-17 20:55   ` Zi Yan

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