David Hildenbrand <[email protected]> wrote:
> ram_block_populate_read() already optimizes for RamDiscardManager.
> However, ram_write_tracking_start() will still try protecting discarded
> memory ranges.
>
> Let's optimize, because discarded ranges don't map any pages and
>
> (1) For anonymous memory, trying to protect using uffd-wp without a mapped
>     page is ignored by the kernel and consequently a NOP.
>
> (2) For shared/file-backed memory, we will fill present page tables in the
>     range with PTE markers. However, we will even allocate page tables
>     just to fill them with unnecessary PTE markers and effectively
>     waste memory.
>
> So let's exclude these ranges, just like ram_block_populate_read()
> already does.
>
> Signed-off-by: David Hildenbrand <[email protected]>

Reviewed-by: Juan Quintela <[email protected]>


Reply via email to