]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: threads: rename process_mask to thread_mask
authorWilly Tarreau <w@1wt.eu>
Tue, 31 Oct 2017 15:06:06 +0000 (16:06 +0100)
committerWilly Tarreau <w@1wt.eu>
Tue, 31 Oct 2017 15:06:06 +0000 (16:06 +0100)
It was a leftover from the last cleaning session; this mask applies
to threads and calling it process_mask is a bit confusing. It's the
same in fd, task and applets.

13 files changed:
include/proto/applet.h
include/proto/fd.h
include/proto/task.h
include/types/applet.h
include/types/fd.h
include/types/task.h
src/applet.c
src/ev_epoll.c
src/ev_kqueue.c
src/ev_poll.c
src/ev_select.c
src/fd.c
src/task.c

index 766fc92311c01fc3bf2fe21b1cbd060ad566850a..a6f2633b1b857d1225a3da98743e5fd63ac36a50 100644 (file)
@@ -50,7 +50,7 @@ static inline void appctx_init(struct appctx *appctx, unsigned long thread_mask)
 {
        appctx->st0 = appctx->st1 = appctx->st2 = 0;
        appctx->io_release = NULL;
-       appctx->process_mask = thread_mask;
+       appctx->thread_mask = thread_mask;
        appctx->state = APPLET_SLEEPING;
 }
 
index 72af70fa9232fe9981b1066896dad0d6c9018c86..e240f5c12c6bba42e5de5e58cd345508efc98e75 100644 (file)
@@ -404,7 +404,7 @@ static inline void fd_insert(int fd, unsigned long thread_mask)
        fdtab[fd].linger_risk = 0;
        fdtab[fd].cloned = 0;
        fdtab[fd].cache = 0;
-       fdtab[fd].process_mask = thread_mask;
+       fdtab[fd].thread_mask = thread_mask;
        SPIN_UNLOCK(FD_LOCK, &fdtab[fd].lock);
 
        SPIN_LOCK(FDTAB_LOCK, &fdtab_lock);
index cb98fefc7ee41d093584bbd3438e9b1d99cb0799..6a89cd96448988ba7bbb7f3a2700c0fcec036679 100644 (file)
@@ -127,11 +127,12 @@ static inline struct task *task_wakeup(struct task *t, unsigned int f)
        return t;
 }
 
+/* change the thread affinity of a task to <thread_mask> */
 static inline void task_set_affinity(struct task *t, unsigned long thread_mask)
 {
-
-       t->process_mask = thread_mask;
+       t->thread_mask = thread_mask;
 }
+
 /*
  * Unlink the task from the wait queue, and possibly update the last_timer
  * pointer. A pointer to the task itself is returned. The task *must* already
@@ -202,7 +203,7 @@ static inline struct task *task_init(struct task *t, unsigned long thread_mask)
        t->wq.node.leaf_p = NULL;
        t->rq.node.leaf_p = NULL;
        t->pending_state = t->state = TASK_SLEEPING;
-       t->process_mask = thread_mask;
+       t->thread_mask = thread_mask;
        t->nice = 0;
        t->calls = 0;
        t->expire = TICK_ETERNITY;
index b56c5631c4fcfb03315a4cc79c43605d06621db9..1c469a51f898ed5b235460e148679da6da192d7a 100644 (file)
@@ -67,7 +67,7 @@ struct appctx {
                                                       if the command is terminated or the session released */
        int cli_severity_output;        /* used within the cli_io_handler to format severity output of informational feedback */
        struct buffer_wait buffer_wait; /* position in the list of objects waiting for a buffer */
-       unsigned long process_mask;     /* mask of thread IDs authorized to process the applet */
+       unsigned long thread_mask;      /* mask of thread IDs authorized to process the applet */
 
        union {
                struct {
index e196aec9844ee00d90e909cf0d40fc9fa543c67c..2da65992a2dd44596a2fea1562bc28d3677783a6 100644 (file)
@@ -94,7 +94,7 @@ enum fd_states {
 struct fdtab {
        void (*iocb)(int fd);                /* I/O handler */
        void *owner;                         /* the connection or listener associated with this fd, NULL if closed */
-       unsigned long process_mask;          /* mask of thread IDs authorized to process the task */
+       unsigned long thread_mask;           /* mask of thread IDs authorized to process the task */
 #ifdef USE_THREAD
        HA_SPINLOCK_T lock;
 #endif
index 799e6c5ed0ac54ef5c0c59e73fea27e9a04bd35d..236324d1b4bda8ab563536e3f35bc151c9b56b55 100644 (file)
@@ -72,7 +72,7 @@ struct task {
        void *context;                  /* the task's context */
        struct eb32_node wq;            /* ebtree node used to hold the task in the wait queue */
        int expire;                     /* next expiration date for this task, in ticks */
-       unsigned long process_mask;     /* mask of thread IDs authorized to process the task */
+       unsigned long thread_mask;      /* mask of thread IDs authorized to process the task */
 };
 
 /*
index 427062e36bcc08b51c5e1492e62f73799cd851fd..47f30c40ad60548ece275f1e76b14bad953f5813 100644 (file)
@@ -43,7 +43,7 @@ void applet_run_active()
        curr = LIST_NEXT(&applet_active_queue, typeof(curr), runq);
        while (&curr->runq != &applet_active_queue) {
                next = LIST_NEXT(&curr->runq, typeof(next), runq);
-               if (curr->process_mask & tid_bit) {
+               if (curr->thread_mask & tid_bit) {
                        LIST_DEL(&curr->runq);
                        curr->state = APPLET_RUNNING;
                        LIST_ADDQ(&applet_cur_queue, &curr->runq);
index d26c3a21f12f13eded54e61fc2cf7e69bc30c703..65e5164fdbf9c41202a4bacbb0c3c0a970883132 100644 (file)
@@ -136,7 +136,7 @@ REGPRM2 static void _do_poll(struct poller *p, int exp)
                unsigned int e = epoll_events[count].events;
                fd = epoll_events[count].data.fd;
 
-               if (!fdtab[fd].owner || !(fdtab[fd].process_mask & tid_bit))
+               if (!fdtab[fd].owner || !(fdtab[fd].thread_mask & tid_bit))
                        continue;
 
                /* it looks complicated but gcc can optimize it away when constants
index 2ae27748a16742212e9d2de42401af48e4b4416b..00dc965c61ec92c1e1c3d3ec9dc1b91cf915ee41 100644 (file)
@@ -122,7 +122,7 @@ REGPRM2 static void _do_poll(struct poller *p, int exp)
                unsigned int n = 0;
                fd = kev[count].ident;
 
-               if (!fdtab[fd].owner || !(fdtab[fd].process_mask & tid_bit))
+               if (!fdtab[fd].owner || !(fdtab[fd].thread_mask & tid_bit))
                        continue;
 
                if (kev[count].filter ==  EVFILT_READ) {
index f7632b61fbdf8cc11a41ef3f6692c86825a633cc..edeffa86bde9aa57e060016a2651c5db417eb001 100644 (file)
@@ -112,7 +112,7 @@ REGPRM2 static void _do_poll(struct poller *p, int exp)
 
                for (count = 0, fd = fds * 8*sizeof(**fd_evts); count < 8*sizeof(**fd_evts) && fd < maxfd; count++, fd++) {
 
-                       if (!fdtab[fd].owner || !(fdtab[fd].process_mask & tid_bit))
+                       if (!fdtab[fd].owner || !(fdtab[fd].thread_mask & tid_bit))
                                continue;
 
                        sr = (rn >> count) & 1;
index 4f5a2d1126c520e0b7b56f883268e8b2cbd9ee1b..5dad408eeffd6d677cccc51fba937fb76d7eaa8d 100644 (file)
@@ -141,7 +141,7 @@ REGPRM2 static void _do_poll(struct poller *p, int exp)
                        /* if we specify read first, the accepts and zero reads will be
                         * seen first. Moreover, system buffers will be flushed faster.
                         */
-                       if (!fdtab[fd].owner || !(fdtab[fd].process_mask & tid_bit))
+                       if (!fdtab[fd].owner || !(fdtab[fd].thread_mask & tid_bit))
                                continue;
 
                        if (FD_ISSET(fd, tmp_evts[DIR_RD]))
index ea5d683b802e7a7ef7cb586421ac61c813af88f6..e8419aae17a37a370ffce18b53705e6762c581dc 100644 (file)
--- a/src/fd.c
+++ b/src/fd.c
@@ -202,7 +202,7 @@ static void fd_dodelete(int fd, int do_close)
        fdtab[fd].owner = NULL;
        fdtab[fd].updated = 0;
        fdtab[fd].new = 0;
-       fdtab[fd].process_mask = 0;
+       fdtab[fd].thread_mask = 0;
        if (do_close)
                close(fd);
        SPIN_UNLOCK(FD_LOCK, &fdtab[fd].lock);
@@ -245,7 +245,7 @@ void fd_process_cached_events()
        for (entry = 0; entry < fd_cache_num; ) {
                fd = fd_cache[entry];
 
-               if (!(fdtab[fd].process_mask & tid_bit))
+               if (!(fdtab[fd].thread_mask & tid_bit))
                        goto next;
                if (SPIN_TRYLOCK(FD_LOCK, &fdtab[fd].lock))
                        goto next;
index 7623da959640e07d2b41158874b2b63624db7675..1768e075dc33b8bce05da9a5804181b6aa4acf0d 100644 (file)
@@ -229,7 +229,7 @@ void process_runnable_tasks()
                while (local_tasks_count < 16) {
                        t = eb32_entry(rq_next, struct task, rq);
                        rq_next = eb32_next(rq_next);
-                       if (t->process_mask & tid_bit) {
+                       if (t->thread_mask & tid_bit) {
                                /* detach the task from the queue */
                                __task_unlink_rq(t);
                                t->state |= TASK_RUNNING;