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