Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp6503572imm; Mon, 23 Jul 2018 20:24:26 -0700 (PDT) X-Google-Smtp-Source: AAOMgpf684FDDAqE2PGGmVjxc/XY9MqsC+emQHvB8S4CuNwM70FzkRmcUfgsprm5HDcJhybjhrqH X-Received: by 2002:a63:24c:: with SMTP id 73-v6mr15011654pgc.252.1532402666394; Mon, 23 Jul 2018 20:24:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532402666; cv=none; d=google.com; s=arc-20160816; b=pyFKCbQbColA8oj9sZwemgj8s8U14LL1LHf3eu6nhlQLOdFs3zitZFz44WXkMi+J4+ pBhY3SORLXAFEYcfeAiXUritij3CjzyXIJh3DZ7Zs7QYxn1mdDybPAyeskwrrPHlE+nk KGnlr+WDz3Z2hqSqC0Pl8Ab6YI3iwkdT0Z2UIJnmsQHAwyAbZr5jQyOTpPgDpveSVHh0 E6JX+72+d1l+tkFLfTqVT1ZE+RiT//aMDcxN/Qp/Ky4AGWcorCaD43Y20HDbuFJIMBfJ n0LZDmxipekmPfqc79MBdTyybqem0j3C9yU6GmbP54qsQP4DxXBT5Wez1kYvqpM+J20L rCJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:subject:mime-version:user-agent :message-id:in-reply-to:date:references:cc:to:from :arc-authentication-results; bh=Q0UoNdnhOv6Gi21sjEiGnx8nnn4qK6bilmW6jec8UcM=; b=KvfQm30QCrr+xpTvGJChvW9vvlunufvrXSsTcFDb4pREdKQu4+dEuPDmbMbBydnhwj zpW1TRokJXkFyx5PGcEsm23HiBGKK1OfLLE64Zir+SzMmN/PSBHmB3Ulnwuoh2StOmGT f0YIBKmfUQJBD9D0IFl16CDPtZbpozlv89xjQWwKkgZJ+xx2id/WIRFnw25MRHQR6O7C 8xeEqdQ+Dk5hzqpxywVtUpGynmwtZ/lLRmqDXhCoTwhVh+F/RCTaqt6iA7uhGP6ShNgM RnD45XXt26G7FqimY1ywJHJ/6CD5ggQkukc6BDd+jE/48eF7MI589gzyUdvtstS3/Gs5 JiCQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id cc6-v6si2499646plb.458.2018.07.23.20.24.11; Mon, 23 Jul 2018 20:24:26 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388161AbeGXE1a (ORCPT + 99 others); Tue, 24 Jul 2018 00:27:30 -0400 Received: from out01.mta.xmission.com ([166.70.13.231]:58619 "EHLO out01.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388131AbeGXE1a (ORCPT ); Tue, 24 Jul 2018 00:27:30 -0400 Received: from in02.mta.xmission.com ([166.70.13.52]) by out01.mta.xmission.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.87) (envelope-from ) id 1fhnup-0005VA-Pl; Mon, 23 Jul 2018 21:23:11 -0600 Received: from [97.119.167.31] (helo=x220.xmission.com) by in02.mta.xmission.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.87) (envelope-from ) id 1fhnuo-0005W4-OM; Mon, 23 Jul 2018 21:23:11 -0600 From: ebiederm@xmission.com (Eric W. Biederman) To: Linus Torvalds Cc: Oleg Nesterov , Andrew Morton , , Wen Yang , majiang References: <87h8l9p7bg.fsf@xmission.com> <20180709104158.GA23796@redhat.com> <87sh4so5jv.fsf@xmission.com> <20180709145726.GA26149@redhat.com> <877em4nxo0.fsf@xmission.com> <87lgakm4ol.fsf@xmission.com> <20180710134639.GA2453@redhat.com> <877em2jxyr.fsf_-_@xmission.com> Date: Mon, 23 Jul 2018 22:22:58 -0500 In-Reply-To: <877em2jxyr.fsf_-_@xmission.com> (Eric W. Biederman's message of "Tue, 10 Jul 2018 21:41:16 -0500") Message-ID: <87efft5ncd.fsf_-_@xmission.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-XM-SPF: eid=1fhnuo-0005W4-OM;;;mid=<87efft5ncd.fsf_-_@xmission.com>;;;hst=in02.mta.xmission.com;;;ip=97.119.167.31;;;frm=ebiederm@xmission.com;;;spf=neutral X-XM-AID: U2FsdGVkX18LK28Ek+rcUtxQ6Ld97N4cAjvUx2CVWOM= X-SA-Exim-Connect-IP: 97.119.167.31 X-SA-Exim-Mail-From: ebiederm@xmission.com X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on sa02.xmission.com X-Spam-Level: * X-Spam-Status: No, score=1.3 required=8.0 tests=ALL_TRUSTED,BAYES_50, DCC_CHECK_NEGATIVE,T_TooManySym_01,XMNoVowels autolearn=disabled version=3.4.0 X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * 1.5 XMNoVowels Alpha-numberic number with no vowels * 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% * [score: 0.5000] * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa02 1397; Body=1 Fuz1=1 Fuz2=1] * 0.0 T_TooManySym_01 4+ unique symbols in subject X-Spam-DCC: XMission; sa02 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: *;Linus Torvalds X-Spam-Relay-Country: X-Spam-Timing: total 690 ms - load_scoreonly_sql: 0.19 (0.0%), signal_user_changed: 4.6 (0.7%), b_tie_ro: 2.9 (0.4%), parse: 1.80 (0.3%), extract_message_metadata: 7 (1.0%), get_uri_detail_list: 3.5 (0.5%), tests_pri_-1000: 12 (1.7%), tests_pri_-950: 3.1 (0.5%), tests_pri_-900: 1.85 (0.3%), tests_pri_-400: 41 (5.9%), check_bayes: 39 (5.6%), b_tokenize: 15 (2.2%), b_tok_get_all: 11 (1.6%), b_comp_prob: 5 (0.7%), b_tok_touch_all: 3.3 (0.5%), b_finish: 0.87 (0.1%), tests_pri_0: 582 (84.4%), check_dkim_signature: 1.12 (0.2%), check_dkim_adsp: 6 (0.8%), tests_pri_500: 10 (1.5%), rewrite_mail: 0.00 (0.0%) Subject: [PATCH 00/20] PIDTYPE_TGID removal of fork restarts X-Spam-Flag: No X-SA-Exim-Version: 4.2.1 (built Thu, 05 May 2016 13:38:54 -0600) X-SA-Exim-Scanned: Yes (on in02.mta.xmission.com) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(-)