diff --git a/common b/common index c2154f348..f0059871a 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit c2154f348716f1dede266204d9b4f62d505b7604 +Subproject commit f0059871af74e121b2d091cb445ba0b048ba675b diff --git a/include/villas/path.h b/include/villas/path.h index d250efaf3..bd3ec8067 100644 --- a/include/villas/path.h +++ b/include/villas/path.h @@ -80,6 +80,7 @@ struct vpath { double rate; /**< A timeout for */ int enabled; /**< Is this path enabled. */ + int affinity; /**< Thread affinity. */ int poll; /**< Weather or not to use poll(2). */ int reverse; /**< This path has a matching reverse path. */ int builtin; /**< This path should use built-in hooks by default. */ diff --git a/lib/path.cpp b/lib/path.cpp index 6ee2c7bc8..5fad3c6db 100644 --- a/lib/path.cpp +++ b/lib/path.cpp @@ -46,6 +46,7 @@ #include #include #include +#include #include #include @@ -178,6 +179,7 @@ int path_init(struct vpath *p) p->poll = -1; p->queuelen = DEFAULT_QUEUE_LENGTH; p->original_sequence_no = -1; + p->affinity = 0; p->state = State::INITIALIZED; @@ -401,7 +403,7 @@ int path_parse(struct vpath *p, json_t *cfg, struct vlist *nodes) if (ret) return ret; - ret = json_unpack_ex(cfg, &err, 0, "{ s: o, s?: o, s?: o, s?: b, s?: b, s?: b, s?: i, s?: s, s?: b, s?: F, s?: o, s?: b, s?: s}", + ret = json_unpack_ex(cfg, &err, 0, "{ s: o, s?: o, s?: o, s?: b, s?: b, s?: b, s?: i, s?: s, s?: b, s?: F, s?: o, s?: b, s?: s, s?: i }", "in", &json_in, "out", &json_out, "hooks", &json_hooks, @@ -414,7 +416,8 @@ int path_parse(struct vpath *p, json_t *cfg, struct vlist *nodes) "rate", &p->rate, "mask", &json_mask, "original_sequence_no", &p->original_sequence_no, - "uuid", &uuid + "uuid", &uuid, + "affinity", &p->affinity ); if (ret) throw ConfigError(cfg, err, "node-config-path", "Failed to parse path configuration"); @@ -641,6 +644,9 @@ int path_start(struct vpath *p) if (ret) return ret; + if (p->affinity) + kernel::rt::setThreadAffinity(p->tid, p->affinity); + return 0; }