summaryrefslogtreecommitdiff
path: root/lib/intel_allocator_msgchannel.c
diff options
context:
space:
mode:
authorZbigniew Kempczyński <zbigniew.kempczynski@intel.com>2020-10-23 09:30:13 +0200
committerZbigniew Kempczyński <zbigniew.kempczynski@intel.com>2021-04-13 15:44:38 +0200
commit6428c6c3a2a1c2a5a2dd4b9bde1ed1e254b31915 (patch)
tree4b591a1d480b951764e2f5c0c256065c8c67f4f8 /lib/intel_allocator_msgchannel.c
parent9960e3d39e9e35636806f6e039b729b6dea7bdbb (diff)
lib/intel_allocator_msgchannel: Scale to 4k of parallel clients
When playing with multiprocess mode in allocator we're currently using sysvipc message queues in blocking mode (request/response). We can calculate then what is maximum depth for the queue for requested number of children. Change alters kernel queue depth to cover 4k users (1 is main thread and 4095 are children). We're still prone to unlimited wait in allocator thread (more than 4095 children successfully send the messages) but we're going to address this later. Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com> Cc: Andrzej Turko <andrzej.turko@linux.intel.com> Cc: Dominik Grzegorzek <dominik.grzegorzek@intel.com> Cc: Chris Wilson <chris@chris-wilson.co.uk> Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch> Acked-by: Petri Latvala <petri.latvala@intel.com>
Diffstat (limited to 'lib/intel_allocator_msgchannel.c')
-rw-r--r--lib/intel_allocator_msgchannel.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/intel_allocator_msgchannel.c b/lib/intel_allocator_msgchannel.c
index 8280bc4e..172858d3 100644
--- a/lib/intel_allocator_msgchannel.c
+++ b/lib/intel_allocator_msgchannel.c
@@ -17,6 +17,7 @@ extern __thread pid_t child_tid;
#define FTOK_IGT_ALLOCATOR_KEY "/tmp/igt.allocator.key"
#define FTOK_IGT_ALLOCATOR_PROJID 2020
+#define MAXQLEN 4096
#define ALLOCATOR_REQUEST 1
@@ -62,6 +63,13 @@ static void msgqueue_init(struct msg_channel *channel)
queue = msgget(key, IPC_CREAT);
igt_debug("msg queue: %d\n", queue);
+ igt_assert(msgctl(queue, IPC_STAT, &qstat) == 0);
+ igt_debug("msg size in bytes: %lu\n", qstat.msg_qbytes);
+ qstat.msg_qbytes = MAXQLEN * sizeof(struct msgqueue_buf);
+ igt_debug("resizing queue to support %d requests\n", MAXQLEN);
+ igt_assert_f(msgctl(queue, IPC_SET, &qstat) == 0,
+ "Couldn't change queue size to %lu\n", qstat.msg_qbytes);
+
msgdata = calloc(1, sizeof(*msgdata));
igt_assert(msgdata);
msgdata->key = key;