Re: [PATCH] mm/migrate: fix CPUHP state to update node demotion order

From: Huang, Ying
Date: Tue Sep 21 2021 - 02:41:40 EST


Thomas Gleixner <tglx@xxxxxxxxxxxxx> writes:

> On Sat, Sep 18 2021 at 10:58, Huang Ying wrote:
>> @@ -72,6 +72,7 @@ enum cpuhp_state {
>> CPUHP_SLUB_DEAD,
>> CPUHP_DEBUG_OBJ_DEAD,
>> CPUHP_MM_WRITEBACK_DEAD,
>> + CPUHP_MM_DEMOTION_OFFLINE,
>
> Please keep the _DEAD convention in that section. The plugged CPU is
> already gone.

Sure. Will do that.

>> CPUHP_MM_VMSTAT_DEAD,
>> CPUHP_SOFTIRQ_DEAD,
>> CPUHP_NET_MVNETA_DEAD,
>> @@ -240,6 +241,7 @@ enum cpuhp_state {
>> CPUHP_AP_BASE_CACHEINFO_ONLINE,
>> CPUHP_AP_ONLINE_DYN,
>> CPUHP_AP_ONLINE_DYN_END = CPUHP_AP_ONLINE_DYN + 30,
>> + CPUHP_AP_MM_DEMOTION_ONLINE,
>
> Are there any ordering requirements of these states vs. other CPU
> hotplug states?
>
> If not, then please use the dynamically allocated states.
>
> If so, then please add a comment:
>
> + /* Must be before CPUHP_XXX and after CPUHP_YYY */
> + CPUHP_MM_DEMOTION_OFFLINE,

The callbacks need to be called after node_states[N_CPU] has been
updated during CPU online/offline. While node_states[N_CPU] is updated
in CPUHP_AP_ONLINE_DYN and CPUHP_MM_VMSTAT_DEAD. So the new state must
be before CPUHP_MM_VMSTAT_DEAD for offline and after CPUHP_AP_ONLINE_DYN
for online. I will update the patch and add the comments.

Best Regards,
Huang, Ying