"dev" <dev-boun...@openvswitch.org> wrote on 06/01/2016 06:55:41 AM:

> From: Quentin Monnet <quentin.mon...@6wind.com>
> To: ovs-dev <dev@openvswitch.org>
> Date: 06/01/2016 06:56 AM
> Subject: Re: [ovs-dev] [PATCH] lib: Use a more accurate value for
> CPU count (sched_getaffinity).
> Sent by: "dev" <dev-boun...@openvswitch.org>
>
> Hi all,
>
> Does anyone have some feedback about this patch, please?
>
> Best regards,
> Quentin

[snip...]

> > @@ -614,9 +555,17 @@ count_cpu_cores(void)
> >
> >      if (ovsthread_once_start(&once)) {
> >  #ifndef _WIN32
> > -        parse_cpuinfo(&n_cores);
> > -        if (!n_cores) {
> > -            n_cores = sysconf(_SC_NPROCESSORS_ONLN);
> > +        n_cores = sysconf(_SC_NPROCESSORS_ONLN);
> > +        if (n_cores > 0) {
> > +            cpu_set_t *set = CPU_ALLOC(n_cores);
> > +
> > +            if (set) {
> > +                size_t size = CPU_ALLOC_SIZE(n_cores);
> > +
> > +                if (!sched_getaffinity(0, size, set)) {
> > +                    n_cores = CPU_COUNT_S(size, set);
> > +                }
> > +            }
> >          }
> >  #else
> >          SYSTEM_INFO sysinfo;

It looks to me like there is a missing CPU_FREE(set)
call at the end of the new if block...

Ryan Moats
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to