From: Vincent Fu Date: Fri, 29 Sep 2023 14:04:50 +0000 (-0400) Subject: workqueue: handle nice better X-Git-Tag: fio-3.36~8 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=1353b1b9bbd6717c89e32883e87aa5cfe4cb04dc;p=fio.git workqueue: handle nice better nice returns the program's schedule priority. This can be a negative value when there is no error condition. To check if nice is triggering an error we have to check errno. The most recent three macOS test failures appear to be due to this problem. https://github.com/axboe/fio/actions/runs/6347762639/job/17243247222 https://github.com/axboe/fio/actions/runs/6346019205/job/17239370410 https://github.com/axboe/fio/actions/runs/6241934089/job/16944981876 Signed-off-by: Vincent Fu --- diff --git a/workqueue.c b/workqueue.c index 9e6c41ff..3636bc3a 100644 --- a/workqueue.c +++ b/workqueue.c @@ -136,7 +136,8 @@ static void *worker_thread(void *data) sk_out_assign(sw->sk_out); if (wq->ops.nice) { - if (nice(wq->ops.nice) < 0) { + errno = 0; + if (nice(wq->ops.nice) == -1 && errno != 0) { log_err("workqueue: nice %s\n", strerror(errno)); ret = 1; }