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 */
short nice; /* task prio from -1024 to +1024 */
- /* 16-bit hole here */
+ short tid; /* TID where it's allowed to run, <0 if anywhere */
unsigned long thread_mask; /* mask of thread IDs authorized to process the task */
uint64_t call_date; /* date of the last task wakeup or call */
uint64_t lat_time; /* total latency time experienced */
*/
static inline void task_set_affinity(struct task *t, unsigned long thread_mask)
{
+ int thr;
+
+ if (atleast2(thread_mask))
+ thr = -1;
+ else
+ thr = my_ffsl(thread_mask) - 1;
+
if (unlikely(task_in_wq(t))) {
task_unlink_wq(t);
t->thread_mask = thread_mask;
+ t->tid = thr;
task_queue(t);
}
- else
+ else {
t->thread_mask = thread_mask;
+ t->tid = thr;
+ }
}
/*
t->rq.node.leaf_p = NULL;
t->state = TASK_SLEEPING;
t->thread_mask = thread_mask;
- if (atleast2(thread_mask))
+ if (atleast2(thread_mask)) {
t->state |= TASK_SHARED_WQ;
+ t->tid = -1;
+ }
+ else
+ t->tid = my_ffsl(thread_mask) - 1;
t->nice = 0;
t->calls = 0;
t->call_date = 0;
}
chunk_appendf(&trash,
- " task=%p (state=0x%02x nice=%d calls=%u rate=%u exp=%s tmask=0x%lx%s",
+ " task=%p (state=0x%02x nice=%d calls=%u rate=%u exp=%s tid=%d tmask=0x%lx%s",
strm->task,
strm->task->state,
strm->task->nice, strm->task->calls, read_freq_ctr(&strm->call_rate),
tick_is_expired(strm->task->expire, now_ms) ? "<PAST>" :
human_time(TICKS_TO_MS(strm->task->expire - now_ms),
TICKS_TO_MS(1000)) : "<NEVER>",
+ strm->task->tid,
strm->task->thread_mask,
task_in_rq(strm->task) ? ", running" : "");
}
else if ((tmpctx = sc_appctx(scf)) != NULL) {
chunk_appendf(&trash,
- " app0=%p st0=%d st1=%d st2=%d applet=%s tmask=0x%lx nice=%d calls=%u rate=%u cpu=%llu lat=%llu\n",
+ " app0=%p st0=%d st1=%d st2=%d applet=%s tid=%d tmask=0x%lx nice=%d calls=%u rate=%u cpu=%llu lat=%llu\n",
tmpctx,
tmpctx->st0,
tmpctx->st1,
tmpctx->_st2,
tmpctx->applet->name,
+ tmpctx->t->tid,
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);
}
else if ((tmpctx = sc_appctx(scb)) != NULL) {
chunk_appendf(&trash,
- " app1=%p st0=%d st1=%d st2=%d applet=%s tmask=0x%lx nice=%d calls=%u rate=%u cpu=%llu lat=%llu\n",
+ " app1=%p st0=%d st1=%d st2=%d applet=%s tid=%d tmask=0x%lx nice=%d calls=%u rate=%u cpu=%llu lat=%llu\n",
tmpctx,
tmpctx->st0,
tmpctx->st1,
tmpctx->_st2,
tmpctx->applet->name,
+ tmpctx->t->tid,
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);