[libvirt] [PATCH 10/34] qemu: Don't use priv->ncpus to iterate cgroup setting

Peter Krempa pkrempa at redhat.com
Thu Jan 28 13:57:19 UTC 2016


On Sat, Jan 16, 2016 at 10:22:13 -0500, John Ferlan wrote:
> 
> 
> On 01/14/2016 11:26 AM, Peter Krempa wrote:
> > Iterate over all cpus skipping inactive ones.
> > ---
> >  src/qemu/qemu_driver.c | 15 ++++++++++++---
> >  1 file changed, 12 insertions(+), 3 deletions(-)
> > 
> 
> Patch 7 introduces virDomainDefGetVcpumap (or GetOnlineVcpuMap) - why
> not use that instead and then iterate the set bits.  This works, but the
> less places that check for vcpu->online perhaps the better. Perhaps also
> a way to reduce the decision points of using ->maxvcpus or the
> virDomainDefGetVcpusMax call...

That would end up in two cases:

1) The bitmap would be recalculated before every use.
This increases complexity twofold since the function iterates the list
once to assemble the bitmap and then you iterate the bitmap to get the
objects.

2) The bitmap would need to be stored persistently
This again introduces two different places where data has to be stored.
It either then will require us to keep it in sync the two places or
remove one and the def->vcpus and def->vcpumap would need to be used in
parallel always.

I don't like either of those since the target was to remove two places
storing data about one object.

Peter
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20160128/626d46d8/attachment-0001.sig>


More information about the libvir-list mailing list