[GIT PULL] TIF_NOTIFY_SIGNAL for all archs

From: Jens Axboe
Date: Wed Dec 16 2020 - 09:34:25 EST


Hi Linus,

This pull sits on top of of the core entry/exit and x86 entry branch
from the tip tree, which contains the generic and x86 parts of this
work. Here we convert the rest of the archs to support
TIF_NOTIFY_SIGNAL. With that done, we can get rid of JOBCTL_TASK_WORK
from task_work and signal.c, and also remove a deadlock work-around in
io_uring around knowing that signal based task_work waking is invoked
with the sighand wait queue head lock.

The motivation for this work is to decouple signal notify based
task_work, of which io_uring is a heavy user of, from sighand. The
sighand lock becomes a huge contention point, particularly for threaded
workloads where it's shared between threads. Even outside of threaded
applications it's slower than it needs to be.

Roman Gershman <romger@xxxxxxxxxx> reported that his networked workload
dropped from 1.6M QPS at 80% CPU to 1.0M QPS at 100% CPU after io_uring
was changed to use TIF_NOTIFY_SIGNAL. The time was all spent hammering
on the sighand lock, showing 57% of the CPU time there [1].

There are further cleanups possible on top of this. One example is
TIF_PATCH_PENDING, where a patch already exists to use TIF_NOTIFY_SIGNAL
instead. Hopefully this will also lead to more consolidation, but the
work stands on its own as well.

This throws a trivial merge conflict with arm64 since you pulled that,
which is just a renumbering exercise and fiddling with _TIF_WORK_MASK in
that same file (arch/arm64/include/asm/thread_info.h).

[1] https://github.com/axboe/liburing/issues/215

Please pull!


The following changes since commit f8394f232b1eab649ce2df5c5f15b0e528c92091:

Linux 5.10-rc3 (2020-11-08 16:10:16 -0800)

are available in the Git repository at:

git://git.kernel.dk/linux-block.git tags/tif-task_work.arch-2020-12-14

for you to fetch changes up to 355fb9e2b78e78b38ec00f5cd9b05c6aceb98335:

io_uring: remove 'twa_signal_ok' deadlock work-around (2020-12-12 09:17:38 -0700)

----------------------------------------------------------------
tif-task_work.arch-2020-12-14

----------------------------------------------------------------
Jens Axboe (30):
Merge tag 'core-entry-notify-signal' of git://git.kernel.org/.../tip/tip into tif-task_work.arch
Merge branch 'x86/entry' of git://git.kernel.org/.../tip/tip into tif-task_work.arch
arc: add support for TIF_NOTIFY_SIGNAL
arm64: add support for TIF_NOTIFY_SIGNAL
m68k: add support for TIF_NOTIFY_SIGNAL
nios32: add support for TIF_NOTIFY_SIGNAL
parisc: add support for TIF_NOTIFY_SIGNAL
powerpc: add support for TIF_NOTIFY_SIGNAL
mips: add support for TIF_NOTIFY_SIGNAL
s390: add support for TIF_NOTIFY_SIGNAL
um: add support for TIF_NOTIFY_SIGNAL
sh: add support for TIF_NOTIFY_SIGNAL
openrisc: add support for TIF_NOTIFY_SIGNAL
csky: add support for TIF_NOTIFY_SIGNAL
hexagon: add support for TIF_NOTIFY_SIGNAL
microblaze: add support for TIF_NOTIFY_SIGNAL
arm: add support for TIF_NOTIFY_SIGNAL
xtensa: add support for TIF_NOTIFY_SIGNAL
alpha: add support for TIF_NOTIFY_SIGNAL
c6x: add support for TIF_NOTIFY_SIGNAL
h8300: add support for TIF_NOTIFY_SIGNAL
ia64: add support for TIF_NOTIFY_SIGNAL
nds32: add support for TIF_NOTIFY_SIGNAL
riscv: add support for TIF_NOTIFY_SIGNAL
sparc: add support for TIF_NOTIFY_SIGNAL
task_work: remove legacy TWA_SIGNAL path
io_uring: JOBCTL_TASK_WORK is no longer used by task_work
signal: kill JOBCTL_TASK_WORK
kernel: remove checking for TIF_NOTIFY_SIGNAL
io_uring: remove 'twa_signal_ok' deadlock work-around

arch/alpha/include/asm/thread_info.h | 2 ++
arch/alpha/kernel/entry.S | 2 +-
arch/alpha/kernel/signal.c | 2 +-
arch/arc/include/asm/thread_info.h | 4 ++-
arch/arc/kernel/entry.S | 3 ++-
arch/arc/kernel/signal.c | 2 +-
arch/arm/include/asm/thread_info.h | 7 +++++-
arch/arm/kernel/entry-common.S | 6 ++---
arch/arm/kernel/entry-v7m.S | 2 +-
arch/arm/kernel/signal.c | 2 +-
arch/arm64/include/asm/thread_info.h | 5 +++-
arch/arm64/kernel/signal.c | 2 +-
arch/c6x/include/asm/thread_info.h | 1 +
arch/c6x/kernel/asm-offsets.c | 1 +
arch/c6x/kernel/signal.c | 3 ++-
arch/csky/include/asm/thread_info.h | 5 +++-
arch/csky/kernel/signal.c | 2 +-
arch/h8300/include/asm/thread_info.h | 4 ++-
arch/h8300/kernel/signal.c | 2 +-
arch/hexagon/include/asm/thread_info.h | 2 ++
arch/hexagon/kernel/process.c | 2 +-
arch/ia64/include/asm/thread_info.h | 4 ++-
arch/ia64/kernel/process.c | 3 ++-
arch/m68k/include/asm/thread_info.h | 1 +
arch/m68k/kernel/signal.c | 3 ++-
arch/microblaze/include/asm/thread_info.h | 2 ++
arch/microblaze/kernel/signal.c | 3 ++-
arch/mips/include/asm/thread_info.h | 4 ++-
arch/mips/kernel/signal.c | 2 +-
arch/nds32/include/asm/thread_info.h | 2 ++
arch/nds32/kernel/ex-exit.S | 2 +-
arch/nds32/kernel/signal.c | 2 +-
arch/nios2/include/asm/thread_info.h | 2 ++
arch/nios2/kernel/signal.c | 3 ++-
arch/openrisc/include/asm/thread_info.h | 2 ++
arch/openrisc/kernel/signal.c | 2 +-
arch/parisc/include/asm/thread_info.h | 4 ++-
arch/parisc/kernel/signal.c | 3 ++-
arch/powerpc/include/asm/thread_info.h | 5 +++-
arch/powerpc/kernel/signal.c | 2 +-
arch/riscv/include/asm/thread_info.h | 5 +++-
arch/riscv/kernel/signal.c | 2 +-
arch/s390/include/asm/thread_info.h | 2 ++
arch/s390/kernel/entry.S | 11 +++++----
arch/s390/kernel/signal.c | 2 +-
arch/sh/include/asm/thread_info.h | 4 ++-
arch/sh/kernel/signal_32.c | 2 +-
arch/sparc/include/asm/thread_info_32.h | 4 ++-
arch/sparc/include/asm/thread_info_64.h | 6 +++--
arch/sparc/kernel/signal_32.c | 2 +-
arch/sparc/kernel/signal_64.c | 2 +-
arch/um/include/asm/thread_info.h | 2 ++
arch/um/kernel/process.c | 3 ++-
arch/xtensa/include/asm/thread_info.h | 5 +++-
arch/xtensa/kernel/entry.S | 4 +--
arch/xtensa/kernel/signal.c | 3 ++-
fs/io_uring.c | 30 ++++++-----------------
include/linux/entry-common.h | 4 ---
include/linux/sched/jobctl.h | 4 +--
include/linux/sched/signal.h | 2 --
include/linux/tracehook.h | 4 ---
kernel/signal.c | 22 -----------------
kernel/task_work.c | 30 +----------------------
63 files changed, 128 insertions(+), 139 deletions(-)

--
Jens Axboe