Re: [RFC] mm/vmstat: Add events for THP migration without split

Anshuman Khandual
2020-05-15T04:04:32Z

On 05/14/2020 11:59 PM, John Hubbard wrote:
> On 2020-05-11 21: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,
>>
>
>
> Hi Anshuman,
>
> It's very nice to see this work, and I think that reporting a bit
> more about THP migration stats is going to make development and
> performance debugging a lot more efficient (and pleasant).

That is definitely one of the motivations for these events here.

>
>
>> 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 ................
>>
>
> I do think we should decouple the trace event name(s) just a *little*
> more, from the mechanisms used to migrate THPs. In other words, let's
> report the number of THP migration successes, and name it
> accordingly--rather than "set" and "remove", which are pretty
> low-level and furthermore depend on today's exact code.

Agreed, the events are low level and follows the implementation very
closely. Hence posted as a RFC instead, as I was not very sure about
these events.

>
> Maybe Zi Yan's recommended name is exactly right, in fact:
>
> THP_PMD_MIGRATION_SUCCESS

Will also add another THP_PMD_MIGRATION_FAILURE even in migrate_pages()
when a huge page could not be allocated and THP gets split.