On Tue, 29 Apr 2025 at 18:34, Peter Xu <[email protected]> wrote:
> I think that's what Fabiano mentioned, but ultimately we need to verify it
> on a reproducer to know.
...
> Looks ok, but please add some comments explain why postcopy needs to do it,
> and especially do it during precopy phase.
>
> I'd use migrate_postcopy_ram() instead.
* Okay. It should be '||' instead of '&&' in the first conditional I
think, we want to write zeropage when postcopy is enabled.
===
diff --git a/migration/multifd-zero-page.c b/migration/multifd-zero-page.c
index dbc1184921..4d6677feab 100644
--- a/migration/multifd-zero-page.c
+++ b/migration/multifd-zero-page.c
@@ -85,9 +85,11 @@ void multifd_recv_zero_page_process(MultiFDRecvParams *p)
{
for (int i = 0; i < p->zero_num; i++) {
void *page = p->host + p->zero[i];
- if (ramblock_recv_bitmap_test_byte_offset(p->block, p->zero[i])) {
+ if (migrate_postcopy_ram() ||
+ ramblock_recv_bitmap_test_byte_offset(p->block, p->zero[i])) {
memset(page, 0, multifd_ram_page_size());
- } else {
+ }
+ if (!ramblock_recv_bitmap_test_byte_offset(p->block, p->zero[i])) {
ramblock_recv_bitmap_set_offset(p->block, p->zero[i]);
}
}
===
* I'll send this one if it looks okay.
> I don't think we can know that - receivedmap set doesn't mean it's a zero
> page, but only says it's been received before. It can also happen e.g. >1
> threads faulted on the same page then the 2nd thread faulted on it may see
> receivedmap set because the 1st thread got faulted already got the fault
> resolved.
* Okay.
Thank you.
---
- Prasad