[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 12:22:36 -0500 |
On Thu, Mar 11, 2021 at 06:15:15PM +0100, David Hildenbrand wrote:
> On 11.03.21 18:11, Peter Xu wrote:
> > On Thu, Mar 11, 2021 at 05:45:46PM +0100, David Hildenbrand wrote:
> > > On 11.03.21 17:39, Dr. David Alan Gilbert wrote:
> > > > * David Hildenbrand (david@redhat.com) wrote:
> > > > > We can create shared anonymous memory via
> > > > > "-object memory-backend-ram,share=on,..."
> > > > > which is, for example, required by PVRDMA for mremap() to work.
> > > > >
> > > > > Shared anonymous memory is weird, though. Instead of MADV_DONTNEED, we
> > > > > have to use MADV_REMOVE. MADV_DONTNEED fails silently and does
> > > > > nothing.
> > > >
> > > > OK, I wonder how stable these rules are; is it defined anywhere that
> > > > it's required?
> > > >
> > >
> > > I had a look at the Linux implementation: it's essentially shmem ... but
> > > we
> > > don't have an fd exposed, so we cannot use fallocate() ... :)
> > >
> > > MADV_REMOVE documents (man):
> > >
> > > "In the initial implementation, only tmpfs(5) was supported MADV_REMOVE;
> > > but
> > > since Linux 3.5, any filesystem which supports the fallocate(2)
> > > FALLOC_FL_PUNCH_HOLE mode also supports MADV_REMOVE."
> >
> > Hmm, I see that MADV_DONTNEED will still tear down all mappings even for
> > anonymous shmem.. what did I miss?
>
> Where did you see that?
I see madvise_dontneed_free() calls zap_page_range().
>
> >
>
> MADV_DONTNEED only invalidates private copies in the pagecache. It's
> essentially useless for any kind of shared mappings.
Since it's about zapping page tables, then I don't understand why it won't work
for shmem..
--
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 <=
- 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, 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