[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v3 02/12] softmmu/physmem: Fix ram_block_discard_range() to h
From: |
Peter Xu |
Subject: |
Re: [PATCH v3 02/12] softmmu/physmem: Fix ram_block_discard_range() to handle shared anonymous memory |
Date: |
Thu, 11 Mar 2021 16:25:05 -0500 |
On Thu, Mar 11, 2021 at 06:41:29PM +0100, David Hildenbrand wrote:
> It zaps the page tables but the shmem pages are still referenced (in the
> pagecache AFAIU). On next user space access, you would fill the page tables
> with the previous content.
>
> That's why MADV_DONTNEED works properly on private anonymous memory, but not
> on shared anonymous memory - the only valid references are in the page
> tables in case of private mappings (well, unless we have other references
> like GUP etc.).
For some reason I thought anonymous shared memory could do auto-recycle, but
after a second thought what you said makes perfect sense.
>
>
> I did wonder, however, if there is benefit in doing both:
>
> MADV_REMOVE followed by MADV_DONTNEED or the other way around. Like, will
> the extra MADV_DONTNEED also remove page tables and not just invalidate/zap
> the entries. Doesn't make a difference functionality-wise, but
> memory-consumption-wise.
>
> I'll still have to have a look.
I saw your other email - that'll be another topic of course. For now I believe
it's not necessary, and your current patch looks valid.
I just hope when qemu decides to disgard the range, we're sure the rdma
mremap() region have been unmaped - iiuc that's the only use case of that.
Otherwise data would corrupt.
--
Peter Xu
- [PATCH v3 00/12] RAM_NORESERVE, MAP_NORESERVE and hostmem "reserve" property, David Hildenbrand, 2021/03/08
- [PATCH v3 01/12] softmmu/physmem: Mark shared anonymous memory RAM_SHARED, David Hildenbrand, 2021/03/08
- [PATCH v3 02/12] softmmu/physmem: Fix ram_block_discard_range() to handle shared anonymous memory, David Hildenbrand, 2021/03/08
- Re: [PATCH v3 02/12] softmmu/physmem: Fix ram_block_discard_range() to handle shared anonymous memory, Dr. David Alan Gilbert, 2021/03/11
- Re: [PATCH v3 02/12] softmmu/physmem: Fix ram_block_discard_range() to handle shared anonymous memory, David Hildenbrand, 2021/03/11
- Re: [PATCH v3 02/12] softmmu/physmem: Fix ram_block_discard_range() to handle shared anonymous memory, Peter Xu, 2021/03/11
- Re: [PATCH v3 02/12] softmmu/physmem: Fix ram_block_discard_range() to handle shared anonymous memory, David Hildenbrand, 2021/03/11
- Re: [PATCH v3 02/12] softmmu/physmem: Fix ram_block_discard_range() to handle shared anonymous memory, David Hildenbrand, 2021/03/11
- Re: [PATCH v3 02/12] softmmu/physmem: Fix ram_block_discard_range() to handle shared anonymous memory, Peter Xu, 2021/03/11
- Re: [PATCH v3 02/12] softmmu/physmem: Fix ram_block_discard_range() to handle shared anonymous memory, David Hildenbrand, 2021/03/11
- Re: [PATCH v3 02/12] softmmu/physmem: Fix ram_block_discard_range() to handle shared anonymous memory,
Peter Xu <=
Re: [PATCH v3 02/12] softmmu/physmem: Fix ram_block_discard_range() to handle shared anonymous memory, Peter Xu, 2021/03/11
[PATCH v3 03/12] softmmu/physmem: Fix qemu_ram_remap() to handle shared anonymous memory, David Hildenbrand, 2021/03/08
[PATCH v3 04/12] util/mmap-alloc: Factor out calculation of the pagesize for the guard page, David Hildenbrand, 2021/03/08
[PATCH v3 05/12] util/mmap-alloc: Factor out reserving of a memory region to mmap_reserve(), David Hildenbrand, 2021/03/08
[PATCH v3 06/12] util/mmap-alloc: Factor out activating of memory to mmap_activate(), David Hildenbrand, 2021/03/08
[PATCH v3 07/12] softmmu/memory: Pass ram_flags into qemu_ram_alloc_from_fd(), David Hildenbrand, 2021/03/08
[PATCH v3 08/12] softmmu/memory: Pass ram_flags into memory_region_init_ram_shared_nomigrate(), David Hildenbrand, 2021/03/08
[PATCH v3 09/12] util/mmap-alloc: Pass flags instead of separate bools to qemu_ram_mmap(), David Hildenbrand, 2021/03/08