Re: [PATCH 1/3] cgroup: read more data from cgroup cpuacct.usage_percpu

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

 



On Fri, Aug 31, 2012 at 05:22:57PM +0800, Guannan Ren wrote:
> On NUMA machine, the length of string got from file
> cpuacct.usage_percpu is quite large, so expand the
> limit of 1024 bytes.
> 
> errors like:
> Failed to read file \
> '/cgroup/cpuacct/libvirt/qemu/rhel6q/cpuacct.usage_percpu': \
> Value too large for defined data type
> ---
>  src/util/cgroup.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/util/cgroup.c b/src/util/cgroup.c
> index 8541c7f..5dc0764 100644
> --- a/src/util/cgroup.c
> +++ b/src/util/cgroup.c
> @@ -360,7 +360,7 @@ static int virCgroupGetValueStr(virCgroupPtr group,
>  
>      VIR_DEBUG("Get value %s", keypath);
>  
> -    rc = virFileReadAll(keypath, 1024, value);
> +    rc = virFileReadAll(keypath, 1024*1024, value);
>      if (rc < 0) {
>          rc = -errno;
>          VIR_DEBUG("Failed to read %s: %m\n", keypath);

  I'm a bit worried about the arbitrary 1MB limit, let's see...
  The problem of that function is that it's completely generic,
it assume nothing about the content. In our case that MAX_CPU *
size(counter) . A counter should not be more than 20 char (very large
already) and MAX_CPU of 4096 doesn't sound crazy though I'm sure we will
have bigger. So 100KB is already a maxed out value ... for that test
case.
  Since virFileReadAll will allocate (a bit more) up to the size of
the file, then okay, 1MB is not insanely large limit,

  ACK,

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel@xxxxxxxxxxxx  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]