From: Willy Tarreau Date: Tue, 13 Jul 2021 16:01:46 +0000 (+0200) Subject: CLEANUP: applet: remove unused thread_mask X-Git-Tag: v2.5-dev2~24 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4c6986a6bcc9b41c4888bda4ce791f935b979fe4;p=thirdparty%2Fhaproxy.git CLEANUP: applet: remove unused thread_mask Since 1.9 with commit 673867c35 ("MAJOR: applets: Use tasks, instead of rolling our own scheduler.") the thread_mask field of the appctx became unused, but the code hadn't been cleaned for this. The appctx has its own task and the task's thread_mask is the one to be displayed. It's worth noting that all calls to appctx_new() pass tid_bit as the thread_mask. This makes sense, and it could be convenient to decide that this becomes the norm and to simplify the API. --- diff --git a/include/haproxy/applet-t.h b/include/haproxy/applet-t.h index 27849f972d..d04c3c84f8 100644 --- a/include/haproxy/applet-t.h +++ b/include/haproxy/applet-t.h @@ -67,7 +67,6 @@ struct appctx { int cli_severity_output; /* used within the cli_io_handler to format severity output of informational feedback */ int cli_level; /* the level of CLI which can be lowered dynamically */ struct buffer_wait buffer_wait; /* position in the list of objects waiting for a buffer */ - unsigned long thread_mask; /* mask of thread IDs authorized to process the applet */ struct task *t; /* task associated to the applet */ struct freq_ctr call_rate; /* appctx call rate */ struct list wait_entry; /* entry in a list of waiters for an event (e.g. ring events) */ diff --git a/include/haproxy/applet.h b/include/haproxy/applet.h index b39b9c406e..091b6991d3 100644 --- a/include/haproxy/applet.h +++ b/include/haproxy/applet.h @@ -42,12 +42,11 @@ int appctx_buf_available(void *arg); * 3 integer states st0, st1, st2 and the chunk used to gather unfinished * commands are zeroed */ -static inline void appctx_init(struct appctx *appctx, unsigned long thread_mask) +static inline void appctx_init(struct appctx *appctx) { appctx->st0 = appctx->st1 = appctx->st2 = 0; appctx->chunk = NULL; appctx->io_release = NULL; - appctx->thread_mask = thread_mask; appctx->call_rate.curr_tick = 0; appctx->call_rate.curr_ctr = 0; appctx->call_rate.prev_ctr = 0; @@ -67,7 +66,7 @@ static inline struct appctx *appctx_new(struct applet *applet, unsigned long thr if (likely(appctx != NULL)) { appctx->obj_type = OBJ_TYPE_APPCTX; appctx->applet = applet; - appctx_init(appctx, thread_mask); + appctx_init(appctx); appctx->t = task_new(thread_mask); if (unlikely(appctx->t == NULL)) { pool_free(pool_head_appctx, appctx); diff --git a/src/stream.c b/src/stream.c index c434708e2f..8ef85e7aa4 100644 --- a/src/stream.c +++ b/src/stream.c @@ -3303,7 +3303,7 @@ static int stats_dump_full_strm_to_buffer(struct stream_interface *si, struct st tmpctx->st1, tmpctx->st2, tmpctx->applet->name, - tmpctx->thread_mask, + tmpctx->t->thread_mask, tmpctx->t->nice, tmpctx->t->calls, read_freq_ctr(&tmpctx->call_rate), (unsigned long long)tmpctx->t->cpu_time, (unsigned long long)tmpctx->t->lat_time); } @@ -3339,7 +3339,7 @@ static int stats_dump_full_strm_to_buffer(struct stream_interface *si, struct st tmpctx->st1, tmpctx->st2, tmpctx->applet->name, - tmpctx->thread_mask, + tmpctx->t->thread_mask, tmpctx->t->nice, tmpctx->t->calls, read_freq_ctr(&tmpctx->call_rate), (unsigned long long)tmpctx->t->cpu_time, (unsigned long long)tmpctx->t->lat_time); }