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.
This commit is contained in:
Willy Tarreau 2021-07-13 18:01:46 +02:00
parent befeae88e8
commit 4c6986a6bc
3 changed files with 4 additions and 6 deletions

View File

@ -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) */

View File

@ -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);

View File

@ -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);
}