Thx Ben for the review,

I think that this should be dummied not just on Windows but on any
> non-Linux kernel, because I doubt that *BSD has the same NUMA interface
> as Linux.
>
>

Yeah, I'll do that.



> Usually, I prefer to write assertions based on predicate functions,
> rather than write specialized assertions for predicates.  So my natural
> inclination would be something like:
>         ovs_assert(cpu_socket_id_is_valid(sid));
> instead of
>         CPU_SOCKET_ID_ASSERT(sid);
>
> contain_all_digits() could be simplified to:
>         return str[strspn(str, "0123456789")] == '\0';
> although your implementation is fine too.
>
> discover_sockets_and_cores() uses a fixed-size buffer and then checks
> that the file name fits.  I guess it would easier to use xasprintf().
>
> SYS_SOCKET_DIR is only used in one place.  It might be easier to
> understand if the file name were just inlined.
>
>

Thx for the suggestions, I adopted all of them,



> If /sys is not mounted or does not contain the expected files, then the
> number of cpus and cores will be zero, I think.  But shouldn't the
> runtime inability to discover cpus and cores behave the same as a
> platform that can't discover cpus and cores at all?  On those platforms
> the various functions return the "unspec" values.
>
>

I agree, I'll make them return *UNSPEC when there is no socket or core.



> I haven't read the later patches.  Do they treat "unspec" differently
> from a single core and CPU?
>
>

Yes, the single core/sockets is treated the same as multiple cores/sockets.
Only "unspec" is treated differently,



> I would use readdir() instead of readdir_r().  See
> http://elliotth.blogspot.com/2012/10/how-not-to-use-readdirr3.html for
> more information.
>
>

Thx for pointing out and sharing the link,  change back to use readdir()




> Acked-by: Ben Pfaff <b...@nicira.com>
>


Consider there are still a number of changes,  I'll repost it in next
series.

Thanks,
Alex Wang,
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to