Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp556538rdb; Tue, 23 Jan 2024 07:43:27 -0800 (PST) X-Google-Smtp-Source: AGHT+IF3fBMvUcJtk/oSd9UjuN+JRaZWdRAQEFE9PIcxIfV6N6a1FIfePMKsBmy4v12At9SxVjGe X-Received: by 2002:ad4:5cee:0:b0:67f:2321:935e with SMTP id iv14-20020ad45cee000000b0067f2321935emr1084764qvb.62.1706024607128; Tue, 23 Jan 2024 07:43:27 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706024607; cv=pass; d=google.com; s=arc-20160816; b=YTcAiYJVzZKxZvIJWzJMoNtgvu0PAibICJxJ8jI+vR9P5PaW57irBtk+0FYBZbOPfv DzhTyfaohwocQbNtszNjo4jhSHupAOntmCZquJ1Df200Q29k4FEkGPtrLLlU5nGVON1D 8asxi5v6iiwYfKGZr0KmPswd4RG0QxzySn2RiGMoQev9VHK6ql4muDkXgic1He28jIdW uJ+bXGE4OxUE1GH1mYnnZWUOVh8yYYD4/wLfQ/me89qXIpAjZMHK/OUvN3LT6mWKUnaz gpxLHhqeSbJ2//pUKUMawEana7fzl0X1rFIszwOFtOqvTiAGO0XRlV+IqMTDrZzMTNLU 0wqQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:in-reply-to:content-disposition:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:message-id :subject:cc:to:from:date:dkim-signature; bh=PF33nZUXk10Fdt+GZc2nbXSpzhr3D6HyvllQ/D4I808=; fh=NrPUQ5fb2LYhfrBFB5+JVUXAypO1HjJgVIb7BqDPkhw=; b=uaKEEaGZtk9K5u06NKuMv3VttDhAfGbJvTMX+1ZL0Z1G3mRx8IFoTmvaXR3IuHz6W3 VAsd9UH62ClyUVumGnjQqVKjbVS8Uj5HnNJ+TaKlBpOXfdrsI/ALNeS47wlwgGYwx/aU 9EB+qOoIJh9BvXODUaF/Ri5cilkRiQzQtk3tdDH+rJI3CbhDapSpK/ipaixN9iInSXHx 8OJUl/ejk2sHt/CGX6r8m/nHmsOr9jP/Yx2rs8JXyJzYdKLjTgnWLxkeKl6V18JVYVG9 0tcCfvSMceTV+4hJLGq4GQpP7a9p5WuaeKdIlejALNmDLNPvf1qgqS7J7T1bXGuR9fIm 9SAA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=NcpuJDFC; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-35565-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35565-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id v7-20020a0ce1c7000000b006848a2c68c3si7966519qvl.464.2024.01.23.07.43.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 07:43:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-35565-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=NcpuJDFC; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-35565-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35565-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id DD0851C244DB for ; Tue, 23 Jan 2024 15:43:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C281765BD6; Tue, 23 Jan 2024 15:35:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="NcpuJDFC" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 89B4465BAF for ; Tue, 23 Jan 2024 15:35:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706024121; cv=none; b=tDPFz5Zn6MSVpyYwaP9wxtC3mo/nF32OIEjQE1eWf6opdU78hb/OlPPj3FfUdeKWauhsYFLbzS2rV3RgJ1Ng5n6+LditENFRFiNqgqs2UixBV+9QYFKsEWgvAUSalLlYjQ6tcHFd8xjtIgMyEB89ovOPNA0DrVJ+RccYL2zmajI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706024121; c=relaxed/simple; bh=3DXhCS9gCYUo/yeEr1UEdliq7S/NZwWpa7NRrM8XxIw=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition:In-Reply-To; b=MuN798J3bXUwreNPsNOXud+3uKbuIlNqR5M3JlVeT4KRSkr55ACJO7Nk75LEN5qknadznh5spp6zgqoejwooceH4361QVbF3f3wVJe1VrWuuxbBQVBXX5vhFUDo80p/0DLR7t5iL93mCyybgI1TL+Q9v+xg4Ukil9fdBcmScn/s= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=NcpuJDFC; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1706024118; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to; bh=PF33nZUXk10Fdt+GZc2nbXSpzhr3D6HyvllQ/D4I808=; b=NcpuJDFCbmAsR8F7Rfxlc+FEpwvpaug5m8ESEZeIEyvfIrVbiJpQOlEfVdU3NCJBy5f0S1 KVauaggHgX5Zsjs6W9JqMUUvolBdvcROZ8XgtrolBaEMp1jQBBGxYIAX3wJGD45LGRpyNT 5k1Bez9GX7l4AjASu1IRkUmBuH2NxK0= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-19-IXos11CQPua1Sy3rPPC_Kw-1; Tue, 23 Jan 2024 10:35:15 -0500 X-MC-Unique: IXos11CQPua1Sy3rPPC_Kw-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0B941869EC2; Tue, 23 Jan 2024 15:35:15 +0000 (UTC) Received: from dhcp-27-174.brq.redhat.com (unknown [10.45.224.197]) by smtp.corp.redhat.com (Postfix) with SMTP id C3D20492BFA; Tue, 23 Jan 2024 15:35:13 +0000 (UTC) Received: by dhcp-27-174.brq.redhat.com (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Tue, 23 Jan 2024 16:34:01 +0100 (CET) Date: Tue, 23 Jan 2024 16:34:00 +0100 From: Oleg Nesterov To: Andrew Morton Cc: "Eric W. Biederman" , Dylan Hatch , linux-kernel@vger.kernel.org Subject: [PATCH 3/3] exit: wait_task_zombie: kill the no longer necessary spin_lock_irq(siglock) Message-ID: <20240123153359.GA21866@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240123153313.GA21832@redhat.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.10 After the recent changes nobody use siglock to read the values protected by stats_lock, we can kill spin_lock_irq(¤t->sighand->siglock) and update the comment. With this patch only __exit_signal() and thread_group_start_cputime() take stats_lock under siglock. Signed-off-by: Oleg Nesterov --- kernel/exit.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/kernel/exit.c b/kernel/exit.c index 3988a02efaef..dfb963d2f862 100644 --- a/kernel/exit.c +++ b/kernel/exit.c @@ -1127,17 +1127,14 @@ static int wait_task_zombie(struct wait_opts *wo, struct task_struct *p) * and nobody can change them. * * psig->stats_lock also protects us from our sub-threads - * which can reap other children at the same time. Until - * we change k_getrusage()-like users to rely on this lock - * we have to take ->siglock as well. + * which can reap other children at the same time. * * We use thread_group_cputime_adjusted() to get times for * the thread group, which consolidates times for all threads * in the group including the group leader. */ thread_group_cputime_adjusted(p, &tgutime, &tgstime); - spin_lock_irq(¤t->sighand->siglock); - write_seqlock(&psig->stats_lock); + write_seqlock_irq(&psig->stats_lock); psig->cutime += tgutime + sig->cutime; psig->cstime += tgstime + sig->cstime; psig->cgtime += task_gtime(p) + sig->gtime + sig->cgtime; @@ -1160,8 +1157,7 @@ static int wait_task_zombie(struct wait_opts *wo, struct task_struct *p) psig->cmaxrss = maxrss; task_io_accounting_add(&psig->ioac, &p->ioac); task_io_accounting_add(&psig->ioac, &sig->ioac); - write_sequnlock(&psig->stats_lock); - spin_unlock_irq(¤t->sighand->siglock); + write_sequnlock_irq(&psig->stats_lock); } if (wo->wo_rusage) -- 2.25.1.362.g51ebf55