On Fri, Oct 25, 2019 at 11:22:50AM -0600, Jens Axboe wrote: > include/linux/sched.h | 1 + > kernel/sched/core.c | 16 +- This all seems pretty harmless, it makes the wq paths wee bit slower, but everything else should be unaffected. Acked-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx> > diff --git a/include/linux/sched.h b/include/linux/sched.h > index 67a1d86981a9..6666e25606b7 100644 > --- a/include/linux/sched.h > +++ b/include/linux/sched.h > @@ -1468,6 +1468,7 @@ extern struct pid *cad_pid; > #define PF_NO_SETAFFINITY 0x04000000 /* Userland is not allowed to meddle with cpus_mask */ > #define PF_MCE_EARLY 0x08000000 /* Early kill for mce process policy */ > #define PF_MEMALLOC_NOCMA 0x10000000 /* All allocation request will have _GFP_MOVABLE cleared */ > +#define PF_IO_WORKER 0x20000000 /* Task is an IO worker */ > #define PF_FREEZER_SKIP 0x40000000 /* Freezer should not count it as freezable */ > #define PF_SUSPEND_TASK 0x80000000 /* This thread called freeze_processes() and should not be frozen */ > > diff --git a/kernel/sched/core.c b/kernel/sched/core.c > index dd05a378631a..a95a2f05f3b5 100644 > --- a/kernel/sched/core.c > +++ b/kernel/sched/core.c > @@ -16,6 +16,7 @@ > #include <asm/tlb.h> > > #include "../workqueue_internal.h" > +#include "../../fs/io-wq.h" > #include "../smpboot.h" > > #include "pelt.h" > @@ -4103,9 +4104,12 @@ static inline void sched_submit_work(struct task_struct *tsk) > * we disable preemption to avoid it calling schedule() again > * in the possible wakeup of a kworker. > */ > - if (tsk->flags & PF_WQ_WORKER) { > + if (tsk->flags & (PF_WQ_WORKER | PF_IO_WORKER)) { > preempt_disable(); > - wq_worker_sleeping(tsk); > + if (tsk->flags & PF_WQ_WORKER) > + wq_worker_sleeping(tsk); > + else > + io_wq_worker_sleeping(tsk); > preempt_enable_no_resched(); > } > > @@ -4122,8 +4126,12 @@ static inline void sched_submit_work(struct task_struct *tsk) > > static void sched_update_worker(struct task_struct *tsk) > { > - if (tsk->flags & PF_WQ_WORKER) > - wq_worker_running(tsk); > + if (tsk->flags & (PF_WQ_WORKER | PF_IO_WORKER)) { > + if (tsk->flags & PF_WQ_WORKER) > + wq_worker_running(tsk); > + else > + io_wq_worker_running(tsk); > + } > } > > asmlinkage __visible void __sched schedule(void) > -- > 2.17.1 >