From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out02.mta.xmission.com (out02.mta.xmission.com [166.70.13.232]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 59F1F30E0E4 for ; Fri, 26 Jun 2026 16:57:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=166.70.13.232 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782493042; cv=none; b=WdcA+MkQV4YQIdNcSio74d7B7gYCdjQu+cjg2t5AzzqmBv+XVH9B8vgGCL8DuU4BPAo9JcWXAtzPcI1UD99Jk6lkmJ8Y7COXwB+ybLxTBDimidDq8aHN7hKYnG1fEapQoFWTxk33vDtG5D2ii1Ut0CyoBEJHbHTawkjKiauJS4M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782493042; c=relaxed/simple; bh=G//ClN1TXRNxdAJmw1En8A8tR94WkjlSGw62SRuqrn8=; h=From:To:Cc:In-Reply-To:References:Date:Message-ID:MIME-Version: Content-Type:Subject; b=EOIAvDi5TV9Op9VTW8rVIqezXa4fMcuOPgInMtb1a9Vct/b14u0Wwme9049BTFqpPvjBAd0JDMkt6VO+zJbVnYldtI2iqQb3hyvLUKAT515M7ryKrBH2LoPhOuumFQq3Y3hl69PCzjlAg4cXJ1AkDoLvMT/cgOKjcWst3dN1JDM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=xmission.com; spf=pass smtp.mailfrom=xmission.com; dkim=pass (1024-bit key) header.d=xmission.com header.i=@xmission.com header.b=NPQSbVyV; arc=none smtp.client-ip=166.70.13.232 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=xmission.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=xmission.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=xmission.com header.i=@xmission.com header.b="NPQSbVyV" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=simple/simple; d=xmission.com; s=xmission; h=Subject:Content-Type:MIME-Version:Message-ID:Date:References: In-Reply-To:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=G//ClN1TXRNxdAJmw1En8A8tR94WkjlSGw62SRuqrn8=; b=NPQSbVyVnGrtpTM5emhOnscGQw ZvFFzlZGq9u0l5rZeoHq4m2BrfS18JMFMNBEv6bFV9+ZitkJDnOIspxi0BtyaPfCy4SBYQAdW+76a lwgtGhczi1bufTgRrtyzOywypopsC9TbeVmnx1hBxgAHhUSliiuyrO7yIeXIV0RPqpAg=; Received: from in02.mta.xmission.com ([166.70.13.52]:46154) by out02.mta.xmission.com with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1wd9rj-008ixN-3E; Fri, 26 Jun 2026 10:57:19 -0600 Received: from ip72-198-198-28.om.om.cox.net ([72.198.198.28]:47210 helo=email.froward.int.ebiederm.org.xmission.com) by in02.mta.xmission.com with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1wd9ri-0041Ef-3r; Fri, 26 Jun 2026 10:57:18 -0600 From: "Eric W. Biederman" To: Andrew Morton Cc: Andy Lutomirski , Kees Cook , Kusaram Devineni , Peter Zijlstra , Thomas Gleixner , Will Drewry , linux-kernel@vger.kernel.org, Oleg Nesterov In-Reply-To: <87o6gx9rc4.fsf@email.froward.int.ebiederm.org> (Eric W. Biederman's message of "Fri, 26 Jun 2026 11:52:43 -0500") References: <87o6gx9rc4.fsf@email.froward.int.ebiederm.org> Date: Fri, 26 Jun 2026 11:57:12 -0500 Message-ID: <87pl1d8ck7.fsf_-_@email.froward.int.ebiederm.org> User-Agent: Gnus/5.13 (Gnus v5.13) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain X-XM-SPF: eid=1wd9ri-0041Ef-3r;;;mid=<87pl1d8ck7.fsf_-_@email.froward.int.ebiederm.org>;;;hst=in02.mta.xmission.com;;;ip=72.198.198.28;;;frm=ebiederm@xmission.com;;;sPfnum=0;;;sPf=pass X-XM-AID: U2FsdGVkX19yRFFEPGZVoupVGfEhw7ewER6C/haTmDQ= X-Spam-Level: * X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * 0.1 BAYES_50 BODY: Bayes spam probability is 40 to 60% * [score: 0.5000] * 1.5 XMNoVowels Alpha-numberic number with no vowels * 0.7 XMSubLong Long Subject * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa04 1397; Body=1 Fuz1=1 Fuz2=1] * 0.0 T_TooManySym_01 4+ unique symbols in subject X-Spam-DCC: XMission; sa04 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: *;Andrew Morton X-Spam-Relay-Country: X-Spam-Timing: total 497 ms - load_scoreonly_sql: 0.12 (0.0%), signal_user_changed: 13 (2.7%), b_tie_ro: 11 (2.3%), parse: 1.78 (0.4%), extract_message_metadata: 18 (3.7%), get_uri_detail_list: 2.2 (0.4%), tests_pri_-2000: 19 (3.8%), tests_pri_-1000: 3.6 (0.7%), tests_pri_-950: 1.62 (0.3%), tests_pri_-900: 1.38 (0.3%), tests_pri_-90: 119 (23.9%), check_bayes: 117 (23.4%), b_tokenize: 9 (1.7%), b_tok_get_all: 6 (1.3%), b_comp_prob: 2.3 (0.5%), b_tok_touch_all: 95 (19.2%), b_finish: 1.18 (0.2%), tests_pri_0: 295 (59.3%), check_dkim_signature: 0.82 (0.2%), check_dkim_adsp: 3.2 (0.7%), poll_dns_idle: 0.84 (0.2%), tests_pri_10: 4.4 (0.9%), tests_pri_500: 15 (3.0%), rewrite_mail: 0.00 (0.0%) Subject: [PATCH 06/11] coredump: In zap_threads complete startup if there is no need to wait X-SA-Exim-Connect-IP: 166.70.13.52 X-SA-Exim-Rcpt-To: oleg@redhat.com, linux-kernel@vger.kernel.org, wad@chromium.org, tglx@kernel.org, peterz@infradead.org, kusaram@devineni.in, kees@kernel.org, luto@kernel.org, akpm@linux-foundation.org X-SA-Exim-Mail-From: ebiederm@xmission.com X-SA-Exim-Scanned: No (on out02.mta.xmission.com); SAEximRunCond expanded to false Remove the need to test the value of core_waiters in coredump_wait by completing core_state->startup when there is an error or there are no other tasks to wait for. This slightly simplifies the logic and prepares for moving zap_threads out of coredump_wait. Signed-off-by: "Eric W. Biederman" --- fs/coredump.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/fs/coredump.c b/fs/coredump.c index 14ec61c8d982..0aa235429cfa 100644 --- a/fs/coredump.c +++ b/fs/coredump.c @@ -517,6 +517,8 @@ static int zap_threads(struct task_struct *tsk, tsk->flags |= PF_DUMPCORE; atomic_set(&core_state->nr_threads, nr); } + if (nr <= 0) + complete(&core_state->startup); spin_unlock_irq(&tsk->sighand->siglock); return nr; } @@ -547,28 +549,26 @@ void coredump_join(struct core_state *core_state) static int coredump_wait(int exit_code, struct core_state *core_state) { struct task_struct *tsk = current; - int core_waiters = -EBUSY; + struct core_thread *ptr; + int core_waiters; init_completion(&core_state->startup); core_state->dumper.task = tsk; core_state->dumper.next = NULL; core_waiters = zap_threads(tsk, core_state, exit_code); - if (core_waiters > 0) { - struct core_thread *ptr; - wait_for_completion_state(&core_state->startup, - TASK_UNINTERRUPTIBLE|TASK_FREEZABLE); - /* - * Wait for all the threads to become inactive, so that - * all the thread context (extended register state, like - * fpu etc) gets copied to the memory. - */ - ptr = core_state->dumper.next; - while (ptr != NULL) { - wait_task_inactive(ptr->task, TASK_ANY); - ptr = ptr->next; - } + wait_for_completion_state(&core_state->startup, + TASK_UNINTERRUPTIBLE|TASK_FREEZABLE); + /* + * Wait for all the threads to become inactive, so that + * all the thread context (extended register state, like + * fpu etc) gets copied to the memory. + */ + ptr = core_state->dumper.next; + while (ptr != NULL) { + wait_task_inactive(ptr->task, TASK_ANY); + ptr = ptr->next; } return core_waiters; -- 2.41.0