Skip to content

PIDTYPE_TGID removal of fork restarts

Eric W. Biederman lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest20 patches 11 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/20pids: Initialize leader_pid in init_taskinit/init_task.c+1 -00 replies
2/20pids: Move task_pid_type into sched/signal.hinclude/linux/sched/signal.h kernel/exit.c+8 -80 replies
3/20pids: Compute task_tgid using signal->leader_pidarch/ia64/kernel/asm-offsets.c arch/ia64/kernel/fsys.S drivers/platform/x86/thinkpad_acpi.c +6 more+22 -170 replies
4/20kvm: Don't open code task_pid in kvm_vcpu_ioctlvirt/kvm/kvm_main.c+1 -10 replies
5/20pids: Move the pgrp and session pid pointers from task_struct to signal_structarch/ia64/kernel/asm-offsets.c arch/ia64/kernel/fsys.S fs/autofs/autofs_i.h +7 more+78 -730 replies
6/20pid: Implement PIDTYPE_TGIDarch/ia64/kernel/asm-offsets.c arch/ia64/kernel/fsys.S arch/s390/kernel/perf_cpum_sf.c +11 more+19 -190 replies
7/20signal: Use PIDTYPE_TGID to clearly store where file signals will be sentdrivers/net/tun.c drivers/tty/tty_io.c fs/fcntl.c +2 more+37 -266 replies
8/20posix-timers: Noralize good_sigeventkernel/time/posix-timers.c+5 -30 replies
9/20signal: Pass pid and pid type into send_sigqueueinclude/linux/sched/signal.h kernel/signal.c kernel/time/posix-timers.c+14 -150 replies
10/20signal: Pass pid type into group_send_sig_infoinclude/linux/signal.h kernel/exit.c kernel/signal.c+11 -60 replies
11/20signal: Pass pid type into send_sigio_to_task & send_sigurg_to_taskfs/fcntl.c+9 -170 replies
12/20signal: Pass pid type into do_send_sig_infodrivers/tty/sysrq.c fs/fcntl.c include/linux/signal.h +2 more+12 -120 replies
13/20signal: Push pid type down into send_signalkernel/signal.c+6 -60 replies
14/20signal: Push pid type down into __send_signalkernel/signal.c+6 -60 replies
15/20signal: Push pid type down into complete_signal.kernel/signal.c+4 -40 replies
16/20fork: Move and describe why the code examines PIDNS_ADDINGkernel/fork.c+7 -40 replies
17/20fork: Unconditionally exit if a fatal signal is pendingkernel/fork.c+6 -00 replies
18/20signal: Add calculate_sigpending()include/linux/sched/signal.h kernel/fork.c kernel/signal.c+15 -03 replies
19/20fork: Have new threads join on-going signal group stopsinclude/linux/sched/signal.h kernel/fork.c kernel/signal.c+31 -120 replies
20/20signal: Don't restart fork when signals come in.include/linux/sched/signal.h kernel/fork.c kernel/signal.c+38 -1614 replies

Reviews trailers per patch

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

Read the v1 thread

Cover letter [PATCH 00/20] PIDTYPE_TGID removal of fork restarts

This took longer than I thought to address all of the issues and double check I am not missing something. I have split of a few of the patches
so now the patch series appears longer. It now covers less ground.

I realized while reviewing the group signals that for none of them is siginfo important. Which means by slightly lowering our quality of implementation in delivering those signals to a brand new process (by not queueing siginfo) I can collect them all in a sigset and the code is no more difficult than a sequence counter. Which means it is straight forward to completely eliminate restarts from fork.

The implemenatation of PIDTYPE_TGID remains the same. How it gets used has changed to guarantee that looking up a thread group by the pid of one of it's threads and sending it a signal continues to work exactly the same as before.

Please take a look and verify that I have caught everything. I think I have but if not please let me know.

Thank you in advance,
Eric

Eric W. Biederman (20):
pids: Initialize leader_pid in init_task
pids: Move task_pid_type into sched/signal.h
pids: Compute task_tgid using signal->leader_pid
kvm: Don't open code task_pid in kvm_vcpu_ioctl
pids: Move the pgrp and session pid pointers from task_struct to signal_struct
pid: Implement PIDTYPE_TGID
signal: Use PIDTYPE_TGID to clearly store where file signals will be sent
posix-timers: Noralize good_sigevent
signal: Pass pid and pid type into send_sigqueue
signal: Pass pid type into group_send_sig_info
signal: Pass pid type into send_sigio_to_task & send_sigurg_to_task
signal: Pass pid type into do_send_sig_info
signal: Push pid type down into send_signal
signal: Push pid type down into __send_signal
signal: Push pid type down into complete_signal.
fork: Move and describe why the code examines PIDNS_ADDING
fork: Unconditionally exit if a fatal signal is pending
signal: Add calculate_sigpending()
fork: Have new threads join on-going signal group stops
signal: Don't restart fork when signals come in.

 arch/ia64/kernel/asm-offsets.c       |  4 +-
 arch/ia64/kernel/fsys.S              | 12 ++---
 arch/s390/kernel/perf_cpum_sf.c      |  2 +-
 drivers/net/tun.c                    |  2 +-
 drivers/platform/x86/thinkpad_acpi.c |  1 +
 drivers/tty/sysrq.c                  |  2 +-
 drivers/tty/tty_io.c                 |  2 +-
 fs/autofs/autofs_i.h                 |  1 +
 fs/exec.c                            |  1 +
 fs/fcntl.c                           | 72 +++++++++++++--------------
 fs/fuse/file.c                       |  1 +
 fs/locks.c                           |  2 +-
 fs/notify/dnotify/dnotify.c          |  3 +-
 fs/notify/fanotify/fanotify.c        |  1 +
 include/linux/init_task.h            |  9 ----
 include/linux/pid.h                  | 11 +----
 include/linux/sched.h                | 31 +++---------
 include/linux/sched/signal.h         | 49 +++++++++++++++++--
 include/linux/signal.h               |  6 ++-
 include/net/scm.h                    |  1 +
 init/init_task.c                     | 12 +++--
 kernel/events/core.c                 |  2 +-
 kernel/exit.c                        | 12 ++---
 kernel/fork.c                        | 70 +++++++++++++++++++--------
 kernel/pid.c                         | 42 ++++++++--------
 kernel/signal.c                      | 94 ++++++++++++++++++++++++++----------
 kernel/time/itimer.c                 |  5 +-
 kernel/time/posix-cpu-timers.c       |  2 +-
 kernel/time/posix-timers.c           | 21 ++++----
 mm/oom_kill.c                        |  4 +-
 virt/kvm/kvm_main.c                  |  2 +-
 31 files changed, 282 insertions(+), 197 deletions(-)