In the kernel I can use the work queues and create them with alloc_workqueue(...) and pass it a flag WQ_HIGHPRI for a high priority workqueue.
I also see you can use apply_workqueue_attrs(...) for changing nice level to something between normal or high priority.
However is it possible to change the scheduling policy of a kernel workqueue? I only see api for that on the task_struct level with: int sched_setscheduler(struct task_struct *, int, const struct sched_param *), but I could not see how to get from a workqueue to the task_struct.
Or would you have manage the kernel threads manually to control the scheduling policy?