Re: [RFC PATCH 0/3] Use pageblock_order for cma and alloc_contig_range alignment.
From: Vlastimil Babka <hidden>
Date: 2021-11-23 17:32:40
Also in:
linux-iommu, linux-mm, linuxppc-dev, lkml
On 11/23/21 17:35, Zi Yan wrote:
On 19 Nov 2021, at 10:15, Zi Yan wrote:quoted
quoted
quoted
From what my understanding, cma required alignment of max(MAX_ORDER - 1, pageblock_order), because when MIGRATE_CMA was introduced, __free_one_page() does not prevent merging two different pageblocks, when MAX_ORDER - 1 > pageblock_order. But current __free_one_page() implementation does prevent that.But it does prevent that only for isolated pageblock, not CMA, and yout patchset doesn't seem to expand that to CMA? Or am I missing something.Yeah, you are right. Originally, I thought preventing merging isolated pageblock with other types of pageblocks is sufficient, since MIGRATE_CMA is always converted from MIGRATE_ISOLATE. But that is not true. I will rework the code. Thanks for pointing this out.I find that two pageblocks with different migratetypes, like MIGRATE_RECLAIMABLE and MIGRATE_MOVABLE can be merged into a single free page after I checked __free_one_page() in detail and printed pageblock information during buddy page merging.
Yes, that can happen. I am not sure what consequence it will cause. Do you have any idea? For MIGRATE_RECLAIMABLE or MIGRATE_MOVABLE or even MIGRATE_UNMOVABLE it's absolutely fine. As long as these pageblocks are fully free (and they are if it's a single free page spanning 2 pageblocks), they can be of any of these type, as they can be reused as needed without causing fragmentation. But in case of MIGRATE_CMA and MIGRATE_ISOLATE, uncontrolled merging would break the specifics of those types. That's why the code is careful for MIGRATE_ISOLATE, and MIGRATE_CMA was until now done in MAX_ORDER granularity. _______________________________________________ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization