Skip to content

Commit

Permalink
fix cpu assignment by assuring stride is non-zero, assert that all ta…
Browse files Browse the repository at this point in the history
…sks have a valid taskqueue
  • Loading branch information
Matt Macy committed Oct 17, 2016
1 parent 535865d commit db39817
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion sys/kern/subr_gtaskqueue.c
Original file line number Diff line number Diff line change
Expand Up @@ -845,7 +845,7 @@ _taskqgroup_adjust(struct taskqgroup *qgroup, int cnt, int stride)
*/
cpu = old_cpu;
for (i = old_cnt; i < cnt; i++) {
for (k = 0; k < qgroup->tqg_stride; k++)
for (k = 0; k < stride; k++)
cpu = CPU_NEXT(cpu);

taskqgroup_cpu_create(qgroup, i, cpu);
Expand Down Expand Up @@ -874,6 +874,15 @@ _taskqgroup_adjust(struct taskqgroup *qgroup, int cnt, int stride)
taskqgroup_attach_deferred(qgroup, gtask);
}

#ifdef INVARIANTS
mtx_lock(&qgroup->tqg_lock);
for (i = 0; i < qgroup->tqg_cnt; i++) {
MPASS(qgroup->tqg_queue[i].tgc_taskq != NULL);
LIST_FOREACH(gtask, &qgroup->tqg_queue[i].tgc_tasks, gt_list)
MPASS(gtask->gt_taskqueue != NULL);
}
mtx_unlock(&qgroup->tqg_lock);
#endif
/*
* If taskq thread count has been reduced.
*/
Expand Down

0 comments on commit db39817

Please sign in to comment.