qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v3 15/15] exec: Ram blocks with resizeable anonymous allocati


From: David Hildenbrand
Subject: Re: [PATCH v3 15/15] exec: Ram blocks with resizeable anonymous allocations under POSIX
Date: Mon, 2 Mar 2020 16:27:26 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0

On 28.02.20 21:21, Peter Xu wrote:
> On Thu, Feb 27, 2020 at 11:12:05AM +0100, David Hildenbrand wrote:
> 
> [...]
> 
>> +static void ram_block_alloc_ram(RAMBlock *rb)
>> +{
>> +    const bool shared = qemu_ram_is_shared(rb);
>> +
>> +    /*
>> +     * If we can, try to allocate actually resizeable ram. Will also fail
>> +     * if qemu_anon_ram_alloc_resizeable() is not implemented.
>> +     */
>> +    if (phys_mem_alloc == qemu_anon_ram_alloc &&
>> +        qemu_ram_is_resizeable(rb) &&
>> +        ram_block_notifiers_support_resize()) {
>> +        rb->host = qemu_anon_ram_alloc_resizeable(rb->used_length,
>> +                                                  rb->max_length,
>> +                                                  &rb->mr->align, shared);
>> +        if (rb->host) {
>> +            rb->flags |= RAM_RESIZEABLE_ALLOC;
> 
> A trivial nit: If it should only be set automatically by the memory
> code, shall we mark it our somewhere just in case someone passed this
> in flag explicitly (which, iiuc, is a misuse)?  Maybe:
> 
>   assert(!(rb->flags | RAM_RESIZEABLE_ALLOC));
> 
> At the entry of this function?  Other than that it looks sane to me:

Excellent idea, thanks!


-- 
Thanks,

David / dhildenb




reply via email to

[Prev in Thread] Current Thread [Next in Thread]