Re: [PATCH RFC] mm: compaction: avoid migrating non-cma pages to a cma area

Vlastimil Babka
2020-04-20T09:29:26Z

On 4/17/20 9:21 PM, Roman Gushchin wrote:
> On Fri, Apr 17, 2020 at 10:37:14AM +0200, Vlastimil Babka wrote:
>> But I've only now also realized how dynamic setting cc->cma is. So in case a
>> zone consists mostly of CMA blocks, removing ALLOC_CMA in
>> __compaction_suitable() would be actually wrong and prevent compaction from
>> doing any work? Sigh. Any idea about that?
>
> Hm, idk, is it a realistic setup? Looks like it depends significantly on
> the exact usecase.

Yes :/ depends e.g. on how many hugepages are reserved, right?

> Another option is to move the cma area closer to the beginning of a zone.

That wouldn't hurt I guess.

>>
>> >>
>> >> And long-term what happens if the "CMA using ZONE_MOVABLE" approach is merged
>> >> and there are not more CMA migratetypes to test? Might this change actually also
>> >> avoid your issue, as said pages without __GFP_MOVABLE won't end up in a
>> >> ZONE_MOVABLE?
>> >
>> > Yeah, this is what I was thinking about. Basically I want to mimic this behavior
>> > right now. Once this approach will be implemented and merged, it will happen
>> > automatically: obviously, compaction won't move pages between different zones.
>
> After the second thought it's not so obvious: CMA would need to migrate pages
> (data) between zones, right? It might bring some other complications.

I don't recall how it was implemented, but I assume yeah. There shouldn't be
complications I think, migrating out of CMA area should cause no issue for CMA,
and such migrations between zones or even nodes already happen.

>>
>> That will be much better. Can't wait, then :)
>
> Yeah, if it will happen soon-ish, we can just wait. I just don't know
> how hard it is and how many edge cases are there to be figured out first.
>
> Do you think that it's better to wait and do not merge this patch upstream?

We could probably merge it and watch for issues, but I'd like to have also Mel
and Joonsoo comment on it :)

Thanks,
Vlastimil

> Thanks!
>