[Devel] [PATCH hci-8.1 1/2] mm/memcontrol: allocate numa_migrate targets of the source folio order
Konstantin Khorenko
khorenko at virtuozzo.com
Wed Oct 28 17:14:25 MSK 2026
On 10/28/26 14:09, Vasileios Almpanis wrote:
...
>> +++ b/mm/memcontrol.c
>> @@ -3480,6 +3480,7 @@ static struct folio *memcg_numa_migrate_new_folio(struct folio *old_folio,
>> {
>> struct memcg_numa_migrate_struct *ms = (void *)private;
>> gfp_t gfp_mask = GFP_HIGHUSER_MOVABLE | __GFP_NORETRY | __GFP_NOWARN;
>> + unsigned int order = 0;
>>
>> ms->current_node = next_node(ms->current_node, *ms->target_nodes);
>> if (ms->current_node >= MAX_NUMNODES) {
>> @@ -3487,13 +3488,13 @@ static struct folio *memcg_numa_migrate_new_folio(struct folio *old_folio,
>> VM_BUG_ON(ms->current_node >= MAX_NUMNODES);
>> }
>>
>> - if (thp_migration_supported() && folio_test_large(old_folio)) {
>> - return __folio_alloc(GFP_TRANSHUGE_LIGHT | __GFP_THISNODE,
>> - HPAGE_PMD_ORDER, ms->current_node,
>> - ms->target_nodes);
>> + if (folio_test_large(old_folio)) {
>> + gfp_mask = GFP_TRANSHUGE_LIGHT | __GFP_THISNODE;
>> + order = folio_order(old_folio);
>> }
>>
>> - return __folio_alloc(gfp_mask, 0, ms->current_node, ms->target_nodes);
>> + return __folio_alloc(gfp_mask, order, ms->current_node,
>> + ms->target_nodes);
>
> The patch looks good to me. There is another issue that is about parsing and
> has nothing to do with this patch but I though of bringing it up. If we
> write an empty nodelist to memory.numa_migrate it will get past
> nodes_subset. memcg_numa_migrate_new_folio will pass MAX_NUMNODES to
> __folio_alloc and will cause OOB. We need another patch that adds
> nodes_empty next to nodes_subset.
Thank you, will think about this in a separate patch(set).
More information about the Devel
mailing list