[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v1 4/5] migration/ram: Rely on used_length for uffd_change_protec
From: |
David Hildenbrand |
Subject: |
[PATCH v1 4/5] migration/ram: Rely on used_length for uffd_change_protection() |
Date: |
Thu, 5 Jan 2023 13:45:27 +0100 |
ram_mig_ram_block_resized() will abort migration (including background
snapshots) when resizing a RAMBlock. ram_block_populate_read() will only
populate RAM up to used_length, so at least for anonymous memory
protecting everything between used_length and max_length won't
actually be protected and is just a NOP.
So let's only protect everything up to used_length.
Note: it still makes sense to register uffd-wp for max_length, such
that RAM_UF_WRITEPROTECT is independent of a changing used_length.
Signed-off-by: David Hildenbrand <david@redhat.com>
---
migration/ram.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/migration/ram.c b/migration/ram.c
index 6a3dbee2c3..73a443f683 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -1901,7 +1901,7 @@ int ram_write_tracking_start(void)
/* Apply UFFD write protection to the block memory range */
if (uffd_change_protection(rs->uffdio_fd, block->host,
- block->max_length, true, false)) {
+ block->used_length, true, false)) {
goto fail;
}
--
2.39.0
- [PATCH v1 0/5] migration/ram: background snapshot fixes and optimiations, David Hildenbrand, 2023/01/05
- [PATCH v1 1/5] migration/ram: Fix populate_read_range(), David Hildenbrand, 2023/01/05
- [PATCH v1 4/5] migration/ram: Rely on used_length for uffd_change_protection(),
David Hildenbrand <=
- [PATCH v1 2/5] migration/ram: Fix error handling in ram_write_tracking_start(), David Hildenbrand, 2023/01/05
- [PATCH v1 3/5] migration/ram: Don't explicitly unprotect when unregistering uffd-wp, David Hildenbrand, 2023/01/05
- [PATCH v1 5/5] migration/ram: Optimize ram_write_tracking_start() for RamDiscardManager, David Hildenbrand, 2023/01/05
- Re: [PATCH v1 0/5] migration/ram: background snapshot fixes and optimiations, Peter Xu, 2023/01/05
- Re: [PATCH v1 0/5] migration/ram: background snapshot fixes and optimiations, David Hildenbrand, 2023/01/23