[libvirt] [PATCHv2] openvz: read vmguarpages/privvmpages to set memory tunables

Eric Blake eblake at redhat.com
Thu May 3 20:37:00 UTC 2012


On 05/03/2012 11:13 AM, Guido Günther wrote:
> ---
> Changes since last time:
>     * check sysconf return value before division
>     * use virStrToLong_ull instead of sscanf
> 
> O.k. to apply?
> Cheers,
>  -- Guido

ACK.


> +    long kb_per_pages;
> +    unsigned long long barrier, limit, val;
> +
> +    virCheckFlags(0, -1);
> +
> +    kb_per_pages = sysconf(_SC_PAGESIZE);

A minor optimization is possible, since sysconf() won't change:

static long kb_per_pages;
if (!kb_per_pages) {
    kb_per_pages = sysconf(_SC_PAGESIZE):
    if (kb_per_pages > 0)
        kb_per_pages /= 1024;
}
if (kb_per_pages <= 0)
    error...

for fewer syscalls over the life of the program.  But what you have is
correct, and not worth a respin just for that tweak, so feel free to
push as-is if you'd like.

-- 
Eric Blake   eblake at redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 620 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20120503/d04ebb2e/attachment-0001.sig>


More information about the libvir-list mailing list