[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v3 4/5] qom: replace object property list with G
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH v3 4/5] qom: replace object property list with GHashTable |
Date: |
Thu, 8 Oct 2015 13:13:09 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 |
On 10/08/2015 08:09 AM, Daniel P. Berrange wrote:
> From: Pavel Fedin <address@hidden>
>
> ARM GICv3 systems with large number of CPUs create lots of IRQ pins. Since
> every pin is represented as a property, number of these properties becomes
> very large. Every property add first makes sure there's no duplicates.
> Traversing the list becomes very slow, therefore qemu initialization takes
> significant time (several seconds for e. g. 16 CPUs).
>
> This patch replaces list with GHashTable, making lookup very fast. The only
> drawback is that object_child_foreach() and object_child_foreach_recursive()
> cannot modify their objects during traversal, since GHashTableIter does not
> have modify-safe version. However, the code seems not to modify objects via
> these functions.
>
> Signed-off-by: Daniel P. Berrange <address@hidden>
> ---
> include/qom/object.h | 10 ++++--
> qom/object.c | 94
> +++++++++++++++++++++++++++++++---------------------
> 2 files changed, 63 insertions(+), 41 deletions(-)
>
> @@ -879,13 +898,11 @@ object_property_add(Object *obj, const char *name,
> const char *type,
> return ret;
> }
>
> - QTAILQ_FOREACH(prop, &obj->properties, node) {
> - if (strcmp(prop->name, name) == 0) {
> - error_setg(errp, "attempt to add duplicate property '%s'"
> + if (g_hash_table_contains(obj->properties, name)) {
> + error_setg(errp, "attempt to add duplicate property '%s'"
> " to object (type '%s')", name,
> object_get_typename(obj));
Indentation is now off on the unchanged lines.
Reviewed-by: Eric Blake <address@hidden>
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
[Qemu-devel] [PATCH v3 5/5] qom: allow properties to be registered against classes, Daniel P. Berrange, 2015/10/08
[Qemu-devel] [PATCH v3 2/5] qmp: convert to use object_property_foreach iterators, Daniel P. Berrange, 2015/10/09
[Qemu-devel] [PATCH v3 4/5] qom: replace object property list with GHashTable, Daniel P. Berrange, 2015/10/09
Re: [Qemu-devel] [PATCH v3 0/5] qom: more efficient object property handling, Eric Blake, 2015/10/09
Re: [Qemu-devel] [PATCH v3 0/5] qom: more efficient object property handling, Pavel Fedin, 2015/10/09