[ovs-dev] [PATCH] ovs-thread: count the number of cpu cores.

YAMAMOTO Takashi yamamoto at valinux.co.jp
Wed Mar 12 01:37:14 UTC 2014


> We use the number of cpu cores to determine the number
> of threads that we spawn. We are not yet sure what is
> the ideal number of OVS userspace threads that can run
> on Hyper-V. Till we figure that out, use the same logic
> of counting CPU cores in Windows too.
> 
> Signed-off-by: Gurucharan Shetty <gshetty at nicira.com>
> ---
>  lib/ovs-thread.c |    6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/lib/ovs-thread.c b/lib/ovs-thread.c
> index b6b51c7..85de014 100644
> --- a/lib/ovs-thread.c
> +++ b/lib/ovs-thread.c
> @@ -509,10 +509,16 @@ count_cpu_cores(void)
>      static long int n_cores;
>  
>      if (ovsthread_once_start(&once)) {
> +#ifndef _WIN32
>          parse_cpuinfo(&n_cores);
>          if (!n_cores) {
>              n_cores = sysconf(_SC_NPROCESSORS_ONLN);
>          }
> +#else
> +        SYSTEM_INFO sysinfo;
> +        GetSystemInfo(&sysinfo);
> +        n_cores = sysinfo.dwNumberOfProcessors;

does this need to be wrapped by ovsthread_once?

YAMAMOTO Takashi

> +#endif
>          ovsthread_once_done(&once);
>      }
>  
> -- 
> 1.7.9.5
> 
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev



More information about the dev mailing list