Re: [PATCH v2 fixed 11/16] util/mmap-alloc: Prepare for resizable mmaps

2020-02-24 Thread David Hildenbrand
On 19.02.20 23:50, Peter Xu wrote: > On Wed, Feb 12, 2020 at 02:42:49PM +0100, David Hildenbrand wrote: >> @@ -178,13 +183,15 @@ void *qemu_ram_mmap(int fd, >> size_t offset, total; >> void *ptr, *guardptr; >> >> +g_assert(QEMU_IS_ALIGNED(size, pagesize)); > > (NOTE: assertion is f

Re: [PATCH v2 fixed 11/16] util/mmap-alloc: Prepare for resizable mmaps

2020-02-19 Thread Peter Xu
On Wed, Feb 12, 2020 at 02:42:49PM +0100, David Hildenbrand wrote: > @@ -178,13 +183,15 @@ void *qemu_ram_mmap(int fd, > size_t offset, total; > void *ptr, *guardptr; > > +g_assert(QEMU_IS_ALIGNED(size, pagesize)); (NOTE: assertion is fine, but as I mentioned in previous patch, I

[PATCH v2 fixed 11/16] util/mmap-alloc: Prepare for resizable mmaps

2020-02-12 Thread David Hildenbrand
When shrinking a mmap we want to re-reserve the already populated area. When growing a memory region, we want to populate starting with a given fd_offset. Prepare by allowing to pass these parameters. Also, let's make sure we always process full pages, to avoid unmapping/remapping pages that are a