Skip to content

RFC Remove kthread usage from io_uring

Jens Axboe io-uring 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest18 patches 30 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/18io_uring: remove the need for relying on an io-wq fallback workerfs/io-wq.c fs/io-wq.h fs/io_uring.c+35 -173 replies
2/18io-wq: don't create any IO workers upfrontfs/io-wq.c+0 -120 replies
3/18io_uring: disable io-wq attachingfs/io_uring.c+22 -330 replies
4/18io-wq: get rid of wq->use_refsfs/io-wq.c fs/io-wq.h+1 -190 replies
5/18io_uring: tie async worker side to the task contextfs/io_uring.c include/linux/io_uring.h+35 -503 replies
6/18io-wq: don't pass 'wqe' needlessly aroundfs/io-wq.c+16 -150 replies
7/18arch: setup PF_IO_WORKER threads like PF_KTHREADarch/alpha/kernel/process.c arch/arc/kernel/process.c arch/arm/kernel/process.c +20 more+23 -232 replies
8/18kernel: treat PF_IO_WORKER like PF_KTHREAD for ptrace/signalskernel/ptrace.c kernel/signal.c+3 -30 replies
9/18io-wq: fork worker threads from original taskfs/io-wq.c fs/io_uring.c include/linux/sched.h+114 -19718 replies
10/18io-wq: worker idling always returns falsefs/io-wq.c+2 -80 replies
11/18io_uring: remove any grabbing of contextfs/io-wq.h fs/io_uring.c+7 -2150 replies
12/18io_uring: remove io_identityfs/io-wq.c fs/io-wq.h fs/io_uring.c +1 more+52 -990 replies
13/18io-wq: only remove worker from free_list, if it was therefs/io-wq.c+7 -30 replies
14/18io-wq: make io_wq_fork_thread() available to other usersfs/io-wq.c fs/io-wq.h+6 -40 replies
15/18io_uring: move SQPOLL thread io-wq forked workerfs/io_uring.c+162 -2840 replies
16/18Revert "proc: don't allow async path resolution of /proc/thread-self components"fs/proc/self.c fs/proc/thread_self.c+1 -80 replies
17/18Revert "proc: don't allow async path resolution of /proc/self components"fs/proc/self.c+0 -70 replies
18/18net: remove cmsg restriction from io_uring based send/recvmsg callsnet/socket.c+0 -100 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCHSET RFC 0/18] Remove kthread usage from io_uring

Hi,

tldr - instead of using kthreads that assume the identity of the original tasks for work that needs offloading to a thread, setup these workers as threads of the original task.

Here's a first cut of moving away from kthreads for io_uring. It passes the test suite and various other testing I've done with it. It also performs better, both for workloads actually using the async offload, but also in general as we slim down structures and kill code from the hot path.

The series is roughly split into these parts:

- Patches 1-6, io_uring/io-wq prep patches
- Patches 7-8, Minor arch/kernel support
- Patches 9-15, switch from kthread to thread, remove state only needed for kthreads
- Patches 16-18, remove now dead/unneeded PF_IO_WORKER restrictions

Comments/suggestions welcome. I'm pretty happy with the series at this point, and particularly with how we end up cutting a lot of code while also unifying how sync vs async is presented.

If you prefer browsing this on cgit, find it here:

https://git.kernel.dk/cgit/linux-block/log/?h=io_uring-worker.v2

 arch/alpha/kernel/process.c      |   2 +-
 arch/arc/kernel/process.c        |   2 +-
 arch/arm/kernel/process.c        |   2 +-
 arch/arm64/kernel/process.c      |   2 +-
 arch/c6x/kernel/process.c        |   2 +-
 arch/csky/kernel/process.c       |   2 +-
 arch/h8300/kernel/process.c      |   2 +-
 arch/hexagon/kernel/process.c    |   2 +-
 arch/ia64/kernel/process.c       |   2 +-
 arch/m68k/kernel/process.c       |   2 +-
 arch/microblaze/kernel/process.c |   2 +-
 arch/mips/kernel/process.c       |   2 +-
 arch/nds32/kernel/process.c      |   2 +-
 arch/nios2/kernel/process.c      |   2 +-
 arch/openrisc/kernel/process.c   |   2 +-
 arch/riscv/kernel/process.c      |   2 +-
 arch/s390/kernel/process.c       |   2 +-
 arch/sh/kernel/process_32.c      |   2 +-
 arch/sparc/kernel/process_32.c   |   2 +-
 arch/sparc/kernel/process_64.c   |   2 +-
 arch/um/kernel/process.c         |   2 +-
 arch/x86/kernel/process.c        |   2 +-
 arch/xtensa/kernel/process.c     |   2 +-
 fs/io-wq.c                       | 393 +++++--------
 fs/io-wq.h                       |  14 +-
 fs/io_uring.c                    | 917 ++++++++++---------------------
 fs/proc/self.c                   |   7 -
 fs/proc/thread_self.c            |   7 -
 include/linux/io_uring.h         |  20 +-
 include/linux/sched.h            |   3 +
 kernel/ptrace.c                  |   2 +-
 kernel/signal.c                  |   4 +-
 net/socket.c                     |  10 -
 33 files changed, 451 insertions(+), 972 deletions(-)
Signature · 1 line
Jens Axboe