]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: applet: remove unused thread_mask
authorWilly Tarreau <w@1wt.eu>
Tue, 13 Jul 2021 16:01:46 +0000 (18:01 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 13 Jul 2021 16:20:34 +0000 (18:20 +0200)
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.

include/haproxy/applet-t.h
include/haproxy/applet.h
src/stream.c

index 27849f972d2cda5c9e6e511108a594a264471bdb..d04c3c84f8e42b816397ddb4d516f1b6bca09fbe 100644 (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) */
index b39b9c406eb52edf8429ef4ef6d0ef0eff3c7b25..091b6991d311bcabc1bc057b8141e0f488357024 100644 (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);
index c434708e2fb5a3d44061c4345753a1307600b802..8ef85e7aa4c1ae5886722f1201b2c588d86f0060 100644 (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);
                }