Thread (2 messages) flat view 2 messages, 2 authors, 2021-11-30

Re: [RFC PATCH 0/3] Use pageblock_order for cma and alloc_contig_range alignment.

From: Vlastimil Babka <hidden>
Date: 2021-11-30 09:11:40
Also in: linux-iommu, linux-mm, linuxppc-dev, lkml

On 11/29/21 23:08, Zi Yan wrote:
On 23 Nov 2021, at 12:32, Vlastimil Babka wrote:
quoted
On 11/23/21 17:35, Zi Yan wrote:
quoted
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.
Thanks for the explanation. Basically migratetypes that can fall back to each
other can be merged into a single free page, right?
Yes.
How about MIGRATE_HIGHATOMIC? It should not be merged with other migratetypes
from my understanding.
Hmm it shouldn't minimally because it has an accounting that would become
broken. So it should prevent merging or make sure the reservations are with
MAX_ORDER granularity, but seems that neither is true? CCing Mel.
--
Best Regards,
Yan, Zi
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help