Skip to content

Commit

Permalink
workqueue: handle nice better
Browse files Browse the repository at this point in the history
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 <vincent.fu@samsung.com>
  • Loading branch information
vincentkfu committed Sep 29, 2023
1 parent 06812a4 commit 1353b1b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion workqueue.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 1353b1b

Please sign in to comment.