I am working on a project that uses OpenMP along with Xen''s VCPU
hotplug feature. The OpenMP libraries are used for writing
multi-threaded applications, and they have a function named
omp_get_num_procs() that is used to determine the number of processors
available on the system. I noticed that when using the xm vcpu-set
command in Xen to change the number of vcpus assigned to a domU that
that omp_get_num_procs() still returns the original value.
In trying to determine the cause of this problem, I found that the
implementation of omp_get_num_procs() is simply calling the
sysconf(_SC_NPROCESSORS_ONLN) function, which is in <unistd.h>. I
looked at the implementation of sysconf and it appears that it is
parsing the /proc/stat file to count the number of cpus that are
online. However, the /proc/stat file is not being updated correctly,
which I think is a bug.
To test this I executed the following program:
---------------------------
#include <stdio.h>
#include <unistd.h>
int main()
{
int num_procs_onln = 0;
num_procs_onln = sysconf(_SC_NPROCESSORS_ONLN);
printf("Number of online processors is: %d\n",num_procs_onln);
return 0;
}
-----------------------------
This program always reported the number of vcpus that the system was
booted with rather than its current configuration. For example if I
booted my system with vcpus = ''6'', and then executed xm
vcpu-set
xen-vm 4 , to change the number of vcpus to 4 the program still
reported 6 processors. I also saw that /proc/cpuinfo would only show
4 processors, but that /proc/stat would still list 6. I think that
/proc/stat should be updated to 4, but I could not figure out why this
was not happening.
If anyone else can test this for me and confirm if they experience the
same problem it would be helpful. Also please let me know if this
should be filed as a bug. I am using Ubuntu 7.10 with Xen 3.2, I am
not sure if this would be a Linux kernel bug or a Xen bug.
Thanks,
-Gabriel
_______________________________________________
Xen-users mailing list
Xen-users@lists.xensource.com
http://lists.xensource.com/xen-users