[ovs-dev] [dpdk patch 1/8] ovs-numa: Add ovs-numa.{c, h} for extracting and storing cpu socket and cpu core info.

Ben Pfaff blp at nicira.com
Wed Aug 13 16:37:37 UTC 2014


On Mon, Aug 11, 2014 at 09:56:36PM -0700, Alex Wang wrote:
> Signed-off-by: Alex Wang <alexw at nicira.com>
> +
> +/* To avoid sparse warning. */
> +#ifdef __linux__
...
> +#endif /* __linux__ */

I didn't see the connection to sparse at first.  I'm still not sure
there is one.  Maybe a better comment:
/* On non-Linux, these functions are defined inline in ovs-numa.h. */

+        /* Constructs the path to node /sys/devices/system/nodeX. */
+        path = xasprintf("/sys/devices/system/node/node%d", i);
+
+        if (strlen(path) >= PATH_MAX) {
+            VLOG_WARN("Path to cpu socket %d exceeds the length limit", i);
+            break;
+        }
The above check seems odd.  PATH_MAX is about 4 kB, I think.  I can't
see any possible way that path would exceed it and, even if it did,
why not let opendir() catch the problem?

In discover_sockets_and_cores(), you can remove endptr.  It is
assigned a value that is never used.

It looks to me like ovs-numa does not verify that every socket has at
least one core.  Should it?



More information about the dev mailing list