From nobody Fri Feb 13 14:11:11 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5E9F8CE7A88 for ; Sat, 23 Sep 2023 09:32:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231284AbjIWJcW (ORCPT ); Sat, 23 Sep 2023 05:32:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231213AbjIWJcQ (ORCPT ); Sat, 23 Sep 2023 05:32:16 -0400 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1DDA4196; Sat, 23 Sep 2023 02:32:10 -0700 (PDT) Received: from kwepemm000003.china.huawei.com (unknown [172.30.72.57]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4Rt3ks6Pzxz15NJV; Sat, 23 Sep 2023 17:29:57 +0800 (CST) Received: from ubuntu2204.huawei.com (10.67.174.22) by kwepemm000003.china.huawei.com (7.193.23.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Sat, 23 Sep 2023 17:32:07 +0800 From: Yang Jihong To: , , , , , , , , , , CC: Subject: [PATCH 1/4] perf bench messaging: Fix coding style issues for sched-messaging Date: Sat, 23 Sep 2023 09:30:34 +0000 Message-ID: <20230923093037.961232-2-yangjihong1@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230923093037.961232-1-yangjihong1@huawei.com> References: <20230923093037.961232-1-yangjihong1@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.67.174.22] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemm000003.china.huawei.com (7.193.23.66) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Fixed several code style issues in sched-messaging: 1. Use one space around "-" and "+" operators. 2. When a long line is broken, the operator is at the end of the line. Signed-off-by: Yang Jihong Reviewed-by: Ian Rogers --- tools/perf/bench/sched-messaging.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tools/perf/bench/sched-messaging.c b/tools/perf/bench/sched-me= ssaging.c index fa1f8f998814..6a33118c8f9b 100644 --- a/tools/perf/bench/sched-messaging.c +++ b/tools/perf/bench/sched-messaging.c @@ -98,7 +98,7 @@ static void *sender(struct sender_context *ctx) =20 again: ret =3D write(ctx->out_fds[j], data + done, - sizeof(data)-done); + sizeof(data) - done); if (ret < 0) err(EXIT_FAILURE, "SENDER: write"); done +=3D ret; @@ -201,8 +201,8 @@ static unsigned int group(pthread_t *pth, int wakefd) { unsigned int i; - struct sender_context *snd_ctx =3D malloc(sizeof(struct sender_context) - + num_fds * sizeof(int)); + struct sender_context *snd_ctx =3D malloc(sizeof(struct sender_context) + + num_fds * sizeof(int)); =20 if (!snd_ctx) err(EXIT_FAILURE, "malloc()"); @@ -239,7 +239,7 @@ static unsigned int group(pthread_t *pth, snd_ctx->wakefd =3D wakefd; snd_ctx->num_fds =3D num_fds; =20 - pth[num_fds+i] =3D create_worker(snd_ctx, (void *)sender); + pth[num_fds + i] =3D create_worker(snd_ctx, (void *)sender); } =20 /* Close the fds we have left */ @@ -288,7 +288,7 @@ int bench_sched_messaging(int argc, const char **argv) =20 total_children =3D 0; for (i =3D 0; i < num_groups; i++) - total_children +=3D group(pth_tab+total_children, num_fds, + total_children +=3D group(pth_tab + total_children, num_fds, readyfds[1], wakefds[0]); =20 /* Wait for everyone to be ready */ --=20 2.34.1 From nobody Fri Feb 13 14:11:11 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B73CCCE7A88 for ; Sat, 23 Sep 2023 09:32:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231283AbjIWJcZ (ORCPT ); Sat, 23 Sep 2023 05:32:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50102 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231219AbjIWJcQ (ORCPT ); Sat, 23 Sep 2023 05:32:16 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1EBA9197; Sat, 23 Sep 2023 02:32:10 -0700 (PDT) Received: from kwepemm000003.china.huawei.com (unknown [172.30.72.54]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Rt3j02QvyzNngT; Sat, 23 Sep 2023 17:28:20 +0800 (CST) Received: from ubuntu2204.huawei.com (10.67.174.22) by kwepemm000003.china.huawei.com (7.193.23.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Sat, 23 Sep 2023 17:32:07 +0800 From: Yang Jihong To: , , , , , , , , , , CC: Subject: [PATCH 2/4] perf bench messaging: Factor out create_worker() Date: Sat, 23 Sep 2023 09:30:35 +0000 Message-ID: <20230923093037.961232-3-yangjihong1@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230923093037.961232-1-yangjihong1@huawei.com> References: <20230923093037.961232-1-yangjihong1@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.67.174.22] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemm000003.china.huawei.com (7.193.23.66) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Refactor the create_worker() helper: 1. Modify the return value and use pthread pointer as a parameter to facilitate value assignment in create_worker(). 2. The thread worker creation and process worker creation are abstracted into independent helpers. No functional change. Test result: # perf bench sched messaging # Running 'sched/messaging' benchmark: # 20 sender and receiver processes per group # 10 groups =3D=3D 400 processes run Total time: 6.332 [sec] # perf bench sched messaging -t # Running 'sched/messaging' benchmark: # 20 sender and receiver threads per group # 10 groups =3D=3D 400 threads run Total time: 5.545 [sec] Signed-off-by: Yang Jihong --- tools/perf/bench/sched-messaging.c | 50 ++++++++++++++++-------------- 1 file changed, 26 insertions(+), 24 deletions(-) diff --git a/tools/perf/bench/sched-messaging.c b/tools/perf/bench/sched-me= ssaging.c index 6a33118c8f9b..ad8596bed77a 100644 --- a/tools/perf/bench/sched-messaging.c +++ b/tools/perf/bench/sched-messaging.c @@ -139,30 +139,12 @@ static void *receiver(struct receiver_context* ctx) return NULL; } =20 -static pthread_t create_worker(void *ctx, void *(*func)(void *)) +static void create_thread_worker(pthread_t *thread, + void *ctx, void *(*func)(void *)) { pthread_attr_t attr; - pthread_t childid; int ret; =20 - if (!thread_mode) { - /* process mode */ - /* Fork the receiver. */ - switch (fork()) { - case -1: - err(EXIT_FAILURE, "fork()"); - break; - case 0: - (*func) (ctx); - exit(0); - break; - default: - break; - } - - return (pthread_t)0; - } - if (pthread_attr_init(&attr) !=3D 0) err(EXIT_FAILURE, "pthread_attr_init:"); =20 @@ -171,12 +153,32 @@ static pthread_t create_worker(void *ctx, void *(*fun= c)(void *)) err(EXIT_FAILURE, "pthread_attr_setstacksize"); #endif =20 - ret =3D pthread_create(&childid, &attr, func, ctx); + ret =3D pthread_create(thread, &attr, func, ctx); if (ret !=3D 0) err(EXIT_FAILURE, "pthread_create failed"); =20 pthread_attr_destroy(&attr); - return childid; +} + +static void create_process_worker(void *ctx, void *(*func)(void *)) +{ + /* Fork the receiver. */ + pid_t pid =3D fork(); + + if (pid =3D=3D -1) { + err(EXIT_FAILURE, "fork()"); + } else if (pid =3D=3D 0) { + (*func) (ctx); + exit(0); + } +} + +static void create_worker(pthread_t *thread, void *ctx, void *(*func)(void= *)) +{ + if (!thread_mode) + return create_process_worker(ctx, func); + else + return create_thread_worker(thread, ctx, func); } =20 static void reap_worker(pthread_t id) @@ -226,7 +228,7 @@ static unsigned int group(pthread_t *pth, ctx->ready_out =3D ready_out; ctx->wakefd =3D wakefd; =20 - pth[i] =3D create_worker(ctx, (void *)receiver); + create_worker(pth + i, ctx, (void *)receiver); =20 snd_ctx->out_fds[i] =3D fds[1]; if (!thread_mode) @@ -239,7 +241,7 @@ static unsigned int group(pthread_t *pth, snd_ctx->wakefd =3D wakefd; snd_ctx->num_fds =3D num_fds; =20 - pth[num_fds + i] =3D create_worker(snd_ctx, (void *)sender); + create_worker(pth + num_fds + i, snd_ctx, (void *)sender); } =20 /* Close the fds we have left */ --=20 2.34.1 From nobody Fri Feb 13 14:11:11 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 98C19CE7A88 for ; Sat, 23 Sep 2023 09:32:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231310AbjIWJc2 (ORCPT ); Sat, 23 Sep 2023 05:32:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50112 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231246AbjIWJcR (ORCPT ); Sat, 23 Sep 2023 05:32:17 -0400 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A81F219E; Sat, 23 Sep 2023 02:32:10 -0700 (PDT) Received: from kwepemm000003.china.huawei.com (unknown [172.30.72.54]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4Rt3kt6Xkfz15NKS; Sat, 23 Sep 2023 17:29:58 +0800 (CST) Received: from ubuntu2204.huawei.com (10.67.174.22) by kwepemm000003.china.huawei.com (7.193.23.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Sat, 23 Sep 2023 17:32:08 +0800 From: Yang Jihong To: , , , , , , , , , , CC: Subject: [PATCH 3/4] perf bench messaging: Store chlid process pid when creating worker for process mode Date: Sat, 23 Sep 2023 09:30:36 +0000 Message-ID: <20230923093037.961232-4-yangjihong1@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230923093037.961232-1-yangjihong1@huawei.com> References: <20230923093037.961232-1-yangjihong1@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.67.174.22] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemm000003.china.huawei.com (7.193.23.66) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" To save pid of child processes when creating worker: 1. The messaging worker is changed to `union` type to store thread id and process pid. 2. Save child process pid in create_process_worker(). 3. Rename `pth_tab` as `work_tab`. Test result: # perf bench sched messaging # Running 'sched/messaging' benchmark: # 20 sender and receiver processes per group # 10 groups =3D=3D 400 processes run Total time: 6.744 [sec] # perf bench sched messaging -t # Running 'sched/messaging' benchmark: # 20 sender and receiver threads per group # 10 groups =3D=3D 400 threads run Total time: 5.788 [sec] Signed-off-by: Yang Jihong --- tools/perf/bench/sched-messaging.c | 47 +++++++++++++++++------------- 1 file changed, 27 insertions(+), 20 deletions(-) diff --git a/tools/perf/bench/sched-messaging.c b/tools/perf/bench/sched-me= ssaging.c index ad8596bed77a..04ffaabdd45b 100644 --- a/tools/perf/bench/sched-messaging.c +++ b/tools/perf/bench/sched-messaging.c @@ -55,6 +55,11 @@ struct receiver_context { int wakefd; }; =20 +union messaging_worker { + pthread_t thread; + pid_t pid; +}; + static void fdpair(int fds[2]) { if (use_pipes) { @@ -139,7 +144,7 @@ static void *receiver(struct receiver_context* ctx) return NULL; } =20 -static void create_thread_worker(pthread_t *thread, +static void create_thread_worker(union messaging_worker *worker, void *ctx, void *(*func)(void *)) { pthread_attr_t attr; @@ -153,35 +158,37 @@ static void create_thread_worker(pthread_t *thread, err(EXIT_FAILURE, "pthread_attr_setstacksize"); #endif =20 - ret =3D pthread_create(thread, &attr, func, ctx); + ret =3D pthread_create(&worker->thread, &attr, func, ctx); if (ret !=3D 0) err(EXIT_FAILURE, "pthread_create failed"); =20 pthread_attr_destroy(&attr); } =20 -static void create_process_worker(void *ctx, void *(*func)(void *)) +static void create_process_worker(union messaging_worker *worker, + void *ctx, void *(*func)(void *)) { /* Fork the receiver. */ - pid_t pid =3D fork(); + worker->pid =3D fork(); =20 - if (pid =3D=3D -1) { + if (worker->pid =3D=3D -1) { err(EXIT_FAILURE, "fork()"); - } else if (pid =3D=3D 0) { + } else if (worker->pid =3D=3D 0) { (*func) (ctx); exit(0); } } =20 -static void create_worker(pthread_t *thread, void *ctx, void *(*func)(void= *)) +static void create_worker(union messaging_worker *worker, + void *ctx, void *(*func)(void *)) { if (!thread_mode) - return create_process_worker(ctx, func); + return create_process_worker(worker, ctx, func); else - return create_thread_worker(thread, ctx, func); + return create_thread_worker(worker, ctx, func); } =20 -static void reap_worker(pthread_t id) +static void reap_worker(union messaging_worker *worker) { int proc_status; void *thread_status; @@ -192,12 +199,12 @@ static void reap_worker(pthread_t id) if (!WIFEXITED(proc_status)) exit(1); } else { - pthread_join(id, &thread_status); + pthread_join(worker->thread, &thread_status); } } =20 /* One group of senders and receivers */ -static unsigned int group(pthread_t *pth, +static unsigned int group(union messaging_worker *worker, unsigned int num_fds, int ready_out, int wakefd) @@ -228,7 +235,7 @@ static unsigned int group(pthread_t *pth, ctx->ready_out =3D ready_out; ctx->wakefd =3D wakefd; =20 - create_worker(pth + i, ctx, (void *)receiver); + create_worker(worker + i, ctx, (void *)receiver); =20 snd_ctx->out_fds[i] =3D fds[1]; if (!thread_mode) @@ -241,7 +248,7 @@ static unsigned int group(pthread_t *pth, snd_ctx->wakefd =3D wakefd; snd_ctx->num_fds =3D num_fds; =20 - create_worker(pth + num_fds + i, snd_ctx, (void *)sender); + create_worker(worker + num_fds + i, snd_ctx, (void *)sender); } =20 /* Close the fds we have left */ @@ -275,14 +282,14 @@ int bench_sched_messaging(int argc, const char **argv) unsigned int num_fds =3D 20; int readyfds[2], wakefds[2]; char dummy; - pthread_t *pth_tab; + union messaging_worker *worker_tab; struct sender_context *pos, *n; =20 argc =3D parse_options(argc, argv, options, bench_sched_message_usage, 0); =20 - pth_tab =3D malloc(num_fds * 2 * num_groups * sizeof(pthread_t)); - if (!pth_tab) + worker_tab =3D malloc(num_fds * 2 * num_groups * sizeof(union messaging_w= orker)); + if (!worker_tab) err(EXIT_FAILURE, "main:malloc()"); =20 fdpair(readyfds); @@ -290,7 +297,7 @@ int bench_sched_messaging(int argc, const char **argv) =20 total_children =3D 0; for (i =3D 0; i < num_groups; i++) - total_children +=3D group(pth_tab + total_children, num_fds, + total_children +=3D group(worker_tab + total_children, num_fds, readyfds[1], wakefds[0]); =20 /* Wait for everyone to be ready */ @@ -306,7 +313,7 @@ int bench_sched_messaging(int argc, const char **argv) =20 /* Reap them all */ for (i =3D 0; i < total_children; i++) - reap_worker(pth_tab[i]); + reap_worker(worker_tab + i); =20 gettimeofday(&stop, NULL); =20 @@ -334,7 +341,7 @@ int bench_sched_messaging(int argc, const char **argv) break; } =20 - free(pth_tab); + free(worker_tab); list_for_each_entry_safe(pos, n, &sender_contexts, list) { list_del_init(&pos->list); free(pos); --=20 2.34.1 From nobody Fri Feb 13 14:11:11 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 14BE6CE7A89 for ; Sat, 23 Sep 2023 09:32:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231339AbjIWJcd (ORCPT ); Sat, 23 Sep 2023 05:32:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50122 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231271AbjIWJcT (ORCPT ); Sat, 23 Sep 2023 05:32:19 -0400 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58EFA136; Sat, 23 Sep 2023 02:32:12 -0700 (PDT) Received: from kwepemm000003.china.huawei.com (unknown [172.30.72.57]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4Rt3jB6BFHzMljc; Sat, 23 Sep 2023 17:28:30 +0800 (CST) Received: from ubuntu2204.huawei.com (10.67.174.22) by kwepemm000003.china.huawei.com (7.193.23.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Sat, 23 Sep 2023 17:32:08 +0800 From: Yang Jihong To: , , , , , , , , , , CC: Subject: [PATCH 4/4] perf bench messaging: Kill child processes when exit abnormally in process mode Date: Sat, 23 Sep 2023 09:30:37 +0000 Message-ID: <20230923093037.961232-5-yangjihong1@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230923093037.961232-1-yangjihong1@huawei.com> References: <20230923093037.961232-1-yangjihong1@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.67.174.22] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemm000003.china.huawei.com (7.193.23.66) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" When exit abnormally in process mode, customize SIGINT and SIGTERM signal handler to kill the forked child processes. Before: # perf bench sched messaging -l 1000000 -g 1 & [1] 8519 # # Running 'sched/messaging' benchmark: # pgrep sched-messaging | wc -l 41 # kill -15 8519 [1]+ Terminated perf bench sched messaging -l 1000000 -g 1 # pgrep sched-messaging | wc -l 40 After: # perf bench sched messaging -l 1000000 -g 1 & [1] 8472 # # Running 'sched/messaging' benchmark: # pgrep sched-messaging | wc -l 41 # kill -15 8472 [1]+ Exit 1 perf bench sched messaging -l 1000000 -g 1 # pgrep sched-messaging | wc -l 0 Signed-off-by: Yang Jihong --- tools/perf/bench/sched-messaging.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/tools/perf/bench/sched-messaging.c b/tools/perf/bench/sched-me= ssaging.c index 04ffaabdd45b..e2b8938b7dc3 100644 --- a/tools/perf/bench/sched-messaging.c +++ b/tools/perf/bench/sched-messaging.c @@ -36,6 +36,7 @@ static bool use_pipes =3D false; static unsigned int nr_loops =3D 100; static bool thread_mode =3D false; static unsigned int num_groups =3D 10; +static unsigned int total_children =3D 0; static struct list_head sender_contexts =3D LIST_HEAD_INIT(sender_contexts= ); static struct list_head receiver_contexts =3D LIST_HEAD_INIT(receiver_cont= exts); =20 @@ -60,6 +61,8 @@ union messaging_worker { pid_t pid; }; =20 +static union messaging_worker *worker_tab; + static void fdpair(int fds[2]) { if (use_pipes) { @@ -260,6 +263,17 @@ static unsigned int group(union messaging_worker *work= er, return num_fds * 2; } =20 +static void sig_handler(int sig __maybe_unused) +{ + unsigned int i; + + /* + * When exit abnormally, kill all forked child processes. + */ + for (i =3D 0; i < total_children; i++) + kill(worker_tab[i].pid, SIGKILL); +} + static const struct option options[] =3D { OPT_BOOLEAN('p', "pipe", &use_pipes, "Use pipe() instead of socketpair()"), @@ -277,12 +291,11 @@ static const char * const bench_sched_message_usage[]= =3D { =20 int bench_sched_messaging(int argc, const char **argv) { - unsigned int i, total_children; + unsigned int i; struct timeval start, stop, diff; unsigned int num_fds =3D 20; int readyfds[2], wakefds[2]; char dummy; - union messaging_worker *worker_tab; struct sender_context *pos, *n; =20 argc =3D parse_options(argc, argv, options, @@ -295,7 +308,11 @@ int bench_sched_messaging(int argc, const char **argv) fdpair(readyfds); fdpair(wakefds); =20 - total_children =3D 0; + if (!thread_mode) { + signal(SIGINT, sig_handler); + signal(SIGTERM, sig_handler); + } + for (i =3D 0; i < num_groups; i++) total_children +=3D group(worker_tab + total_children, num_fds, readyfds[1], wakefds[0]); --=20 2.34.1