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

Re: [libvirt] [PATCH RFC 2/2] Resctrl: Add uitls functions to operate sysfs resctrl




On Wednesday, 21 June 2017 at 10:44 PM, Martin Kletzander wrote:

You don't need to pass the whole structure of all the data. Can't the
qemu function just do something like:

virResctrlLock()
foreach cachetune:
region = virResctrlGetFreeRegion(size, type)
foreach cachetune.vcpu:
virResctrlSetRegion(vcpu.pid, region)

Sure, good suggestion, I will try to read what other tune does. 
Or like with some other tuning, you can have a function that determines
the region when given vcpu and just call it for all vcpus. You can
save the regions in the status XML, so that not only users can see it,
but you can also reference them from that aforementioned function. Or
you could have saved pairs of id: region, but I think that's not needed.

That reminds me, unless referred to from somewhere, the cachetune
doesn't even need the id.

But basically, you don't need to pass the whole cachetune or any other
structure. The code is very messy, check your pointers and don't
compare references to NULLs. Read the diffs after yourself. I know it
works for you, but the code needs to be readable as well.

Forgive me I am not a qualified c programmer for years :(, I will try to 
refine them.

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