MINOR: task: stop abusing the nice field to detect a tasklet

It's cleaner to use a flag from the task's state to detect a tasklet
and it's even cheaper. One of the best benefits is that this will
allow to get the nice field out of the common part since the tasklet
doesn't need it anymore. This commit uses the last task bit available
but that's temporary as the purpose of the change is to extend this.
diff --git a/include/haproxy/task-t.h b/include/haproxy/task-t.h
index 632f461..4661715 100644
--- a/include/haproxy/task-t.h
+++ b/include/haproxy/task-t.h
@@ -50,6 +50,8 @@
 #define TASK_WOKEN_RES    0x2000  /* woken up because of available resource */
 #define TASK_WOKEN_OTHER  0x4000  /* woken up for an unspecified reason */
 
+#define TASK_F_TASKLET    0x8000  /* nature of this task: 0=task 1=tasklet */
+
 /* use this to check a task state or to clean it up before queueing */
 #define TASK_WOKEN_ANY    (TASK_WOKEN_OTHER|TASK_WOKEN_INIT|TASK_WOKEN_TIMER| \
                            TASK_WOKEN_IO|TASK_WOKEN_SIGNAL|TASK_WOKEN_MSG| \
@@ -113,7 +115,7 @@
 #define TASK_COMMON							\
 	struct {							\
 		unsigned short state; /* task state : bitfield of TASK_	*/ \
-		short nice; /* task prio from -1024 to +1024, or -32768 for tasklets */ \
+		short nice; /* task prio from -1024 to +1024 */ \
 		unsigned int calls; /* number of times process was called */ \
 		struct task *(*process)(struct task *t, void *ctx, unsigned short state); /* the function which processes the task */ \
 		void *context; /* the task's context */			\
diff --git a/include/haproxy/task.h b/include/haproxy/task.h
index c717420..8f70f5b 100644
--- a/include/haproxy/task.h
+++ b/include/haproxy/task.h
@@ -83,7 +83,7 @@
 #define TIMER_LOOK_BACK       (1U << 31)
 
 /* tasklets are recognized with nice==-32768 */
-#define TASK_IS_TASKLET(t) ((t)->nice == -32768)
+#define TASK_IS_TASKLET(t) ((t)->state & TASK_F_TASKLET)
 
 
 /* a few exported variables */
@@ -435,15 +435,15 @@
 	return t;
 }
 
-/* Initialize a new tasklet. It's identified as a tasklet by ->nice=-32768. It
- * is expected to run on the calling thread by default, it's up to the caller
- * to change ->tid if it wants to own it.
+/* Initialize a new tasklet. It's identified as a tasklet by its flags
+ * TASK_F_TASKLET. It is expected to run on the calling thread by default,
+ * it's up to the caller to change ->tid if it wants to own it.
  */
 static inline void tasklet_init(struct tasklet *t)
 {
-	t->nice = -32768;
+	t->nice = 0;
 	t->calls = 0;
-	t->state = 0;
+	t->state = TASK_F_TASKLET;
 	t->process = NULL;
 	t->tid = -1;
 #ifdef DEBUG_TASK
diff --git a/src/task.c b/src/task.c
index 4c73b8c..350146d 100644
--- a/src/task.c
+++ b/src/task.c
@@ -487,7 +487,7 @@
 
 		budgets[queue]--;
 		t = (struct task *)LIST_ELEM(tl_queues[queue].n, struct tasklet *, list);
-		state = t->state & (TASK_SHARED_WQ|TASK_SELF_WAKING|TASK_HEAVY|TASK_KILLED);
+		state = t->state & (TASK_SHARED_WQ|TASK_SELF_WAKING|TASK_HEAVY|TASK_F_TASKLET|TASK_KILLED);
 
 		ti->flags &= ~TI_FL_STUCK; // this thread is still running
 		activity[tid].ctxsw++;
@@ -498,7 +498,7 @@
 
 		_HA_ATOMIC_SUB(&sched->rq_total, 1);
 
-		if (TASK_IS_TASKLET(t)) {
+		if (state & TASK_F_TASKLET) {
 			uint64_t before = 0;
 
 			LIST_DEL_INIT(&((struct tasklet *)t)->list);