diff options
author | Brian Behlendorf <[email protected]> | 2015-02-26 16:12:55 -0800 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2015-03-03 10:18:31 -0800 |
commit | 6ab08667a44458f775da9f0ecceddbcea1275746 (patch) | |
tree | b74c2a19ba0da368cfc217b6a679a6e8ec56b992 /module | |
parent | d0d5dd714424365a4da0d887cb641cb2f0ae8844 (diff) |
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 <[email protected]>
Signed-off-by: Tim Chase <[email protected]>
Issue #435
Diffstat (limited to 'module')
-rw-r--r-- | module/splat/splat-taskq.c | 51 |
1 files changed, 31 insertions, 20 deletions
diff --git a/module/splat/splat-taskq.c b/module/splat/splat-taskq.c index 8229fed39..2787bf401 100644 --- a/module/splat/splat-taskq.c +++ b/module/splat/splat-taskq.c @@ -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: |