linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Anshuman Khandual <anshuman.khandual@arm.com>
To: Zi Yan <ziy@nvidia.com>
Cc: linux-mm@kvack.org, Andrew Morton <akpm@linux-foundation.org>,
	"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [RFC] mm/vmstat: Add events for THP migration without split
Date: Fri, 15 May 2020 09:20:43 +0530	[thread overview]
Message-ID: <7b4504c8-8583-d426-fef1-4c14986798c3@arm.com> (raw)
In-Reply-To: <67C72AD3-120C-4825-B67B-AECD4245EC4E@nvidia.com>


On 05/14/2020 07:58 PM, Zi Yan wrote:
> On 12 May 2020, at 0:22, Anshuman Khandual wrote:
> 
>> Add the following new trace events which will help in validating migration
>> events involving PMD based THP pages.
>>
>> 1. THP_PMD_MIGRATION_ENTRY_SET
>> 2. THP_PMD_MIGRATION_ENTRY_REMOVE
>>
>> There are no clear method to confirm whether a THP migration happened with
>> out involving it's split. These trace events along with PGMIGRATE_SUCCESS
>> and PGMIGRATE_FAILURE will provide additional insights. After this change,
>>
>> A single 2M THP (2K base page) when migrated
>>
>> 1. Without split
>>
>> ................
>> pgmigrate_success 1
>> pgmigrate_fail 0
>> ................
>> thp_pmd_migration_entry_set 1
>> thp_pmd_migration_entry_remove 1
>> ................
>>
>> 2. With split
>>
>> ................
>> pgmigrate_success 512
>> pgmigrate_fail 0
>> ................
>> thp_pmd_migration_entry_set 0
>> thp_pmd_migration_entry_remove 0
>> ................
>>
>> pgmigrate_success as 1 instead of 512, provides a hint for possible THP
>> migration event. But then it gets mixed with normal page migrations over
>> time. These additional trace events provide required co-relation.
> 
> To track successful THP migrations, the code below should work, right?
> 
> diff --git a/mm/migrate.c b/mm/migrate.c
> index b1092876e537..d394f5331288 100644
> --- a/mm/migrate.c
> +++ b/mm/migrate.c
> @@ -1220,6 +1220,8 @@ static ICE_noinline int unmap_and_move(new_page_t get_new_page,
>          * we want to retry.
>          */
>         if (rc == MIGRATEPAGE_SUCCESS) {
> +               if (PageTransHuge(newpage))
> +                       count_vm_event(THP_PMD_MIGRATION_SUCCESS);

Thats right.

>                 put_page(page);
>                 if (reason == MR_MEMORY_FAILURE) {
>                         /*

Another THP_PMD_MIGRATION_FAILURE event in migrate_pages() when the THP gets
split as a huge page could not be allocated. Both THP_PMD_MIGRATION_SUCCESS
and THP_PMD_MIGRATION_FAILURE will provide a better understanding regarding
THP migration events on the system.

> 
> Maybe you could give more details on why you want to add the THP migration event and
> how you are going to use the event in your use case. That would be very helpful to this
> code review. Are you going to do anything if you see THP migration failures?

Not at the moment. Like other VM events these new ones will provide required
statistics (and better understanding) on THP migration which can be used to
improve it further. Follows the same good old principle, if we cannot measure
we cannot improve.


  reply	other threads:[~2020-05-15  3:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-12  4:22 [RFC] mm/vmstat: Add events for THP migration without split Anshuman Khandual
2020-05-14 14:28 ` Zi Yan
2020-05-15  3:50   ` Anshuman Khandual [this message]
2020-05-14 18:29 ` John Hubbard
2020-05-15  4:03   ` Anshuman Khandual

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7b4504c8-8583-d426-fef1-4c14986798c3@arm.com \
    --to=anshuman.khandual@arm.com \
    --cc=akpm@linux-foundation.org \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=ziy@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).