Reduce splat_taskq_test2_impl() stack frame size

Slightly increasing the size of a kmutex_t has caused us to exceed
the stack frame warning size in splat_taskq_test2_impl().  To address
this the tq_args have been moved to the heap.

  cc1: warnings being treated as errors
  spl-0.6.3/module/splat/splat-taskq.c:358:
  error: the frame size of 1040 bytes is larger than 1024 bytes

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Tim Chase <tim@chase2k.com>
Issue #435
This commit is contained in:
Brian Behlendorf 2015-02-26 16:12:55 -08:00
parent d0d5dd7144
commit 6ab08667a4

View File

@ -231,7 +231,7 @@ static int
splat_taskq_test2_impl(struct file *file, void *arg, boolean_t prealloc) {
taskq_t *tq[TEST2_TASKQS] = { NULL };
taskqid_t id;
splat_taskq_arg_t tq_args[TEST2_TASKQS];
splat_taskq_arg_t *tq_args[TEST2_TASKQS] = { NULL };
taskq_ent_t *func1_tqes = NULL;
taskq_ent_t *func2_tqes = NULL;
int i, rc = 0;
@ -252,6 +252,12 @@ splat_taskq_test2_impl(struct file *file, void *arg, boolean_t prealloc) {
taskq_init_ent(&func1_tqes[i]);
taskq_init_ent(&func2_tqes[i]);
tq_args[i] = kmalloc(sizeof (splat_taskq_arg_t), GFP_KERNEL);
if (tq_args[i] == NULL) {
rc = -ENOMEM;
break;
}
splat_vprint(file, SPLAT_TASKQ_TEST2_NAME,
"Taskq '%s/%d' creating (%s dispatch)\n",
SPLAT_TASKQ_TEST2_NAME, i,
@ -267,28 +273,28 @@ splat_taskq_test2_impl(struct file *file, void *arg, boolean_t prealloc) {
break;
}
tq_args[i].flag = i;
tq_args[i].id = i;
tq_args[i].file = file;
tq_args[i].name = SPLAT_TASKQ_TEST2_NAME;
tq_args[i]->flag = i;
tq_args[i]->id = i;
tq_args[i]->file = file;
tq_args[i]->name = SPLAT_TASKQ_TEST2_NAME;
splat_vprint(file, SPLAT_TASKQ_TEST2_NAME,
"Taskq '%s/%d' function '%s' dispatching\n",
tq_args[i].name, tq_args[i].id,
tq_args[i]->name, tq_args[i]->id,
sym2str(splat_taskq_test2_func1));
if (prealloc) {
taskq_dispatch_ent(tq[i], splat_taskq_test2_func1,
&tq_args[i], TQ_SLEEP, &func1_tqes[i]);
tq_args[i], TQ_SLEEP, &func1_tqes[i]);
id = func1_tqes[i].tqent_id;
} else {
id = taskq_dispatch(tq[i], splat_taskq_test2_func1,
&tq_args[i], TQ_SLEEP);
tq_args[i], TQ_SLEEP);
}
if (id == 0) {
splat_vprint(file, SPLAT_TASKQ_TEST2_NAME,
"Taskq '%s/%d' function '%s' dispatch "
"failed\n", tq_args[i].name, tq_args[i].id,
"failed\n", tq_args[i]->name, tq_args[i]->id,
sym2str(splat_taskq_test2_func1));
rc = -EINVAL;
break;
@ -296,21 +302,21 @@ splat_taskq_test2_impl(struct file *file, void *arg, boolean_t prealloc) {
splat_vprint(file, SPLAT_TASKQ_TEST2_NAME,
"Taskq '%s/%d' function '%s' dispatching\n",
tq_args[i].name, tq_args[i].id,
tq_args[i]->name, tq_args[i]->id,
sym2str(splat_taskq_test2_func2));
if (prealloc) {
taskq_dispatch_ent(tq[i], splat_taskq_test2_func2,
&tq_args[i], TQ_SLEEP, &func2_tqes[i]);
tq_args[i], TQ_SLEEP, &func2_tqes[i]);
id = func2_tqes[i].tqent_id;
} else {
id = taskq_dispatch(tq[i], splat_taskq_test2_func2,
&tq_args[i], TQ_SLEEP);
tq_args[i], TQ_SLEEP);
}
if (id == 0) {
splat_vprint(file, SPLAT_TASKQ_TEST2_NAME, "Taskq "
"'%s/%d' function '%s' dispatch failed\n",
tq_args[i].name, tq_args[i].id,
tq_args[i]->name, tq_args[i]->id,
sym2str(splat_taskq_test2_func2));
rc = -EINVAL;
break;
@ -320,31 +326,36 @@ splat_taskq_test2_impl(struct file *file, void *arg, boolean_t prealloc) {
/* When rc is set we're effectively just doing cleanup here, so
* ignore new errors in that case. They just cause noise. */
for (i = 0; i < TEST2_TASKQS; i++) {
if (tq_args[i] == NULL)
continue;
if (tq[i] != NULL) {
splat_vprint(file, SPLAT_TASKQ_TEST2_NAME,
"Taskq '%s/%d' waiting\n",
tq_args[i].name, tq_args[i].id);
tq_args[i]->name, tq_args[i]->id);
taskq_wait(tq[i]);
splat_vprint(file, SPLAT_TASKQ_TEST2_NAME,
"Taskq '%s/%d; destroying\n",
tq_args[i].name, tq_args[i].id);
tq_args[i]->name, tq_args[i]->id);
taskq_destroy(tq[i]);
if (!rc && tq_args[i].flag != ((i * 2) + 1)) {
if (!rc && tq_args[i]->flag != ((i * 2) + 1)) {
splat_vprint(file, SPLAT_TASKQ_TEST2_NAME,
"Taskq '%s/%d' processed tasks "
"out of order; %d != %d\n",
tq_args[i].name, tq_args[i].id,
tq_args[i].flag, i * 2 + 1);
tq_args[i]->name, tq_args[i]->id,
tq_args[i]->flag, i * 2 + 1);
rc = -EINVAL;
} else {
splat_vprint(file, SPLAT_TASKQ_TEST2_NAME,
"Taskq '%s/%d' processed tasks "
"in the correct order; %d == %d\n",
tq_args[i].name, tq_args[i].id,
tq_args[i].flag, i * 2 + 1);
tq_args[i]->name, tq_args[i]->id,
tq_args[i]->flag, i * 2 + 1);
}
kfree(tq_args[i]);
}
}
out: