[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 8/9] util/mmap-alloc: Support RAM_NORESERVE via MAP_NORESE
From: |
Peter Xu |
Subject: |
Re: [PATCH v2 8/9] util/mmap-alloc: Support RAM_NORESERVE via MAP_NORESERVE |
Date: |
Fri, 5 Mar 2021 10:51:41 -0500 |
On Fri, Mar 05, 2021 at 04:44:36PM +0100, David Hildenbrand wrote:
> On 05.03.21 16:42, Peter Xu wrote:
> > On Fri, Mar 05, 2021 at 11:16:33AM +0100, David Hildenbrand wrote:
> > > +#define OVERCOMMIT_MEMORY_PATH "/proc/sys/vm/overcommit_memory"
> > > +static bool map_noreserve_effective(int fd, bool readonly, bool shared)
> > > +{
> >
> > [...]
> >
> > > @@ -184,8 +251,7 @@ void *qemu_ram_mmap(int fd,
> > > size_t offset, total;
> > > void *ptr, *guardptr;
> > > - if (noreserve) {
> > > - error_report("Skipping reservation of swap space is not
> > > supported");
> > > + if (noreserve && !map_noreserve_effective(fd, shared, readonly)) {
> >
> > Need to switch "shared" & "readonly"?
>
> Indeed, interestingly it has the same effect (as we don't have anonymous
> read-only memory in QEMU :) )
But note there is still a "g_assert(!shared || fd >= 0);" inside.. :)
>
> (wouldn't have happened with flags ... hmm)
Right.
--
Peter Xu
- [PATCH v2 2/9] util/mmap-alloc: Factor out calculation of the pagesize for the guard page, (continued)
- [PATCH v2 2/9] util/mmap-alloc: Factor out calculation of the pagesize for the guard page, David Hildenbrand, 2021/03/05
- [PATCH v2 3/9] util/mmap-alloc: Factor out reserving of a memory region to mmap_reserve(), David Hildenbrand, 2021/03/05
- [PATCH v2 4/9] util/mmap-alloc: Factor out activating of memory to mmap_activate(), David Hildenbrand, 2021/03/05
- [PATCH v2 5/9] softmmu/memory: Pass ram_flags into qemu_ram_alloc_from_fd(), David Hildenbrand, 2021/03/05
- [PATCH v2 6/9] softmmu/memory: Pass ram_flags into memory_region_init_ram_shared_nomigrate(), David Hildenbrand, 2021/03/05
- [PATCH v2 7/9] memory: introduce RAM_NORESERVE and wire it up in qemu_ram_mmap(), David Hildenbrand, 2021/03/05
- [PATCH v2 8/9] util/mmap-alloc: Support RAM_NORESERVE via MAP_NORESERVE, David Hildenbrand, 2021/03/05
- Re: [PATCH v2 8/9] util/mmap-alloc: Support RAM_NORESERVE via MAP_NORESERVE, Peter Xu, 2021/03/05
- Re: [PATCH v2 8/9] util/mmap-alloc: Support RAM_NORESERVE via MAP_NORESERVE, David Hildenbrand, 2021/03/05
- Re: [PATCH v2 8/9] util/mmap-alloc: Support RAM_NORESERVE via MAP_NORESERVE,
Peter Xu <=
- Re: [PATCH v2 8/9] util/mmap-alloc: Support RAM_NORESERVE via MAP_NORESERVE, David Hildenbrand, 2021/03/05
- Re: [PATCH v2 8/9] util/mmap-alloc: Support RAM_NORESERVE via MAP_NORESERVE, David Hildenbrand, 2021/03/07
- Re: [PATCH v2 8/9] util/mmap-alloc: Support RAM_NORESERVE via MAP_NORESERVE, Marcel Apfelbaum, 2021/03/07
- Re: [PATCH v2 8/9] util/mmap-alloc: Support RAM_NORESERVE via MAP_NORESERVE, David Hildenbrand, 2021/03/08
- Re: [PATCH v2 8/9] util/mmap-alloc: Support RAM_NORESERVE via MAP_NORESERVE, Marcel Apfelbaum, 2021/03/08
[PATCH v2 9/9] hostmem: Wire up RAM_NORESERVE via "reserve" property, David Hildenbrand, 2021/03/05