Add support for work items to contain a priority, and use this
directly with nice. Run compression at nice 1, to make it slightly
less important than the actual IO jobs.
Signed-off-by: Jens Axboe <axboe@fb.com>
} else
data->work.wait = 0;
+ data->work.prio = 1;
tp_queue_work(tdat, &data->work);
if (wait) {
#include <unistd.h>
#include <errno.h>
#include <pthread.h>
+#include <string.h>
#include "../smalloc.h"
#include "../log.h"
struct tp_work *work;
while (!flist_empty(list)) {
+ int prio;
+
work = flist_entry(list->next, struct tp_work, list);
flist_del(&work->list);
+
+ prio = work->prio;
+ if (nice(prio) < 0)
+ log_err("fio: nice %s\n", strerror(errno));
+
work->fn(work);
+
+ if (nice(prio) < 0)
+ log_err("fio: nice %s\n", strerror(errno));
}
}
struct flist_head list;
tp_work_fn *fn;
int wait;
+ int prio;
pthread_cond_t cv;
pthread_mutex_t lock;
volatile int done;