[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v1 00/13] Ram blocks with resizable anonymous allocations und
Re: [PATCH v1 00/13] Ram blocks with resizable anonymous allocations under POSIX
Thu, 6 Feb 2020 10:45:57 +0100
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.3.1
On 06.02.20 10:27, Michael S. Tsirkin wrote:
> On Mon, Feb 03, 2020 at 07:31:12PM +0100, David Hildenbrand wrote:
>> We already allow resizable ram blocks for anonymous memory, however, they
>> are not actually resized. All memory is mmaped() R/W, including the memory
>> exceeding the used_length, up to the max_length.
>> When resizing, effectively only the boundary is moved. Implement actually
>> resizable anonymous allocations and make use of them in resizable ram
>> blocks when possible. Memory exceeding the used_length will be
>> inaccessible. Especially ram block notifiers require care.
>> Having actually resizable anonymous allocations (via mmap-hackery) allows
>> to reserve a big region in virtual address space and grow the
>> accessible/usable part on demand. Even if "/proc/sys/vm/overcommit_memory"
>> is set to "never" under Linux, huge reservations will succeed. If there is
>> not enough memory when resizing (to populate parts of the reserved region),
>> trying to resize will fail. Only the actually used size is reserved in the
>> E.g., virtio-mem  wants to reserve big resizable memory regions and
>> grow the usable part on demand. I think this change is worth sending out
>> individually. Accompanied by a bunch of minor fixes and cleanups.
>>  https://lore.kernel.org/kvm/address@hidden/
> How does this inteact with all the prealloc/mlock things designed
> for realtime?
- Prealloc: we don't support resizable ram blocks with prealloc
-- qemu_ram_alloc_from_ptr() is the only way to get "real" preallocated
ram blocks from a pointer. They are never resizable.
-- "prealloc" with memory backends (e.g., backends/hostmem.c): Memory
backends don't support resizable ram blocks yet. I have patches to
support that, and disallow prealloc for them.
-- file-based ram blocks are not resizable
-- os_mlock() does a mlockall(MCL_CURRENT | MCL_FUTURE)
-- That should work just fine with ordinary mmap() invalidating old
mmaps and creating new mmaps(). Just like when hotplugging/unplugging
Resizing currently only happens during reboot/migration. If mlock_all
would result in issues, we could fallback to old handling (if
(enable_mlock) ...) - but I don't think this is necessary.
So I don't see an issues with that :) Thanks!
David / dhildenb
- [PATCH v1 11/13] util: vfio-helpers: Implement ram_block_resized(), (continued)
- [PATCH v1 11/13] util: vfio-helpers: Implement ram_block_resized(), David Hildenbrand, 2020/02/03
- [PATCH v1 12/13] util: oslib: Resizable anonymous allocations under POSIX, David Hildenbrand, 2020/02/03
- [PATCH v1 06/13] util/mmap-alloc: Factor out reserving of a memory region to mmap_reserve(), David Hildenbrand, 2020/02/03
- [PATCH v1 13/13] exec: Ram blocks with resizable anonymous allocations under POSIX, David Hildenbrand, 2020/02/03
- Re: [PATCH v1 00/13] Ram blocks with resizable anonymous allocations under POSIX, Michael S. Tsirkin, 2020/02/06
- Re: [PATCH v1 00/13] Ram blocks with resizable anonymous allocations under POSIX,
David Hildenbrand <=
- Re: [PATCH v1 00/13] Ram blocks with resizable anonymous allocations under POSIX, Dr. David Alan Gilbert, 2020/02/06