qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: Wei Yang <richardw.yang@linux.intel.com>, qemu-devel@nongnu.org
Cc: imammedo@redhat.com, mst@redhat.com
Subject: Re: [Qemu-devel] [PATCH 2/3] memory-device: break the loop if no hint is provided
Date: Mon, 29 Jul 2019 09:45:24 +0200	[thread overview]
Message-ID: <07a5431d-1928-d1ab-a0a2-7be21b411742@redhat.com> (raw)
In-Reply-To: <20190728131304.1282-3-richardw.yang@linux.intel.com>

On 28.07.19 15:13, Wei Yang wrote:
> When there is no hint, the first un-overlapped range is the proper one.
> Just break the loop instead of iterate the whole list.
> 
> Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>
> ---
>  hw/mem/memory-device.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/hw/mem/memory-device.c b/hw/mem/memory-device.c
> index df3261b32a..413b514586 100644
> --- a/hw/mem/memory-device.c
> +++ b/hw/mem/memory-device.c
> @@ -180,6 +180,8 @@ static uint64_t memory_device_get_free_addr(MachineState *ms,
>                  range_make_empty(&new);
>                  break;
>              }
> +        } else if (!hint) {
> +            break;
>          }
>      }
>  
> 

I think

a) This is fine. I was not able to construct a counter-example where
this would not work. Whenever we modify the range, we check against the
next one in the sorted list. If there is no overlap, it fits. And, it
won't overlap with any other range (and therefore never be changed again)

b) This should therefore not change the assignment order / break migration.

Maybe mention that this will not change the assigned addresses compared
to old code in all scenarios.

Reviewed-by: David Hildenbrand <david@redhat.com>

-- 

Thanks,

David / dhildenb


  parent reply	other threads:[~2019-07-29  7:46 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-28 13:13 [Qemu-devel] [PATCH 0/3] memory-device: refine memory_device_get_free_addr Wei Yang
2019-07-28 13:13 ` [Qemu-devel] [PATCH 1/3] memory-device: not necessary to use goto for the last check Wei Yang
2019-07-29  6:50   ` Igor Mammedov
2019-07-29  7:30   ` David Hildenbrand
2019-07-28 13:13 ` [Qemu-devel] [PATCH 2/3] memory-device: break the loop if no hint is provided Wei Yang
2019-07-29  7:04   ` Igor Mammedov
2019-07-29  7:49     ` Wei Yang
2019-07-29  7:45   ` David Hildenbrand [this message]
2019-07-29  7:50     ` Wei Yang
2019-07-28 13:13 ` [Qemu-devel] [PATCH 3/3] memory-device: break the loop if tmp exceed the hinted range Wei Yang
2019-07-29  7:49   ` David Hildenbrand
2019-07-29  7:53     ` David Hildenbrand
2019-07-29  8:30     ` Wei Yang
2019-07-29  8:42       ` David Hildenbrand
2019-07-29  8:30     ` Igor Mammedov
2019-07-29 12:56       ` Wei Yang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=07a5431d-1928-d1ab-a0a2-7be21b411742@redhat.com \
    --to=david@redhat.com \
    --cc=imammedo@redhat.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=richardw.yang@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).