All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>
Subject: [GIT PULL] TIF_NOTIFY_SIGNAL for all archs
Date: Wed, 16 Dec 2020 07:33:42 -0700	[thread overview]
Message-ID: <701d4747-bbbb-dbb4-d828-63d096fcc22a@kernel.dk> (raw)

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@amazon.com> 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


             reply	other threads:[~2020-12-16 14:34 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-16 14:33 Jens Axboe [this message]
2020-12-16 21:17 ` [GIT PULL] TIF_NOTIFY_SIGNAL for all archs pr-tracker-bot
2020-12-16 22:04   ` [PATCH] arm64: make _TIF_WORK_MASK bits contiguous (was: Re: [GIT PULL] TIF_NOTIFY_SIGNAL for all archs) Mark Rutland
2020-12-16 22:06     ` Linus Torvalds
2020-12-16 22:11       ` [PATCH] arm64: make _TIF_WORK_MASK bits contiguous Jens Axboe
2020-12-16 22:14       ` [PATCH] arm64: make _TIF_WORK_MASK bits contiguous (was: Re: [GIT PULL] TIF_NOTIFY_SIGNAL for all archs) Catalin Marinas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=701d4747-bbbb-dbb4-d828-63d096fcc22a@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.