Received: by 2002:ab2:710b:0:b0:1ef:a325:1205 with SMTP id z11csp1852381lql; Wed, 13 Mar 2024 09:51:07 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXo0iyDkr9Ldv77qN9hgVnrvYoRNrG36YLhmKuIaA6idRwe6ATEwp6CBRe092QZytljGp9u2WUosIjLrcJPxmjEy7IlP+pmkL5GtvWzCQ== X-Google-Smtp-Source: AGHT+IFHvdxxnN1nw0WzySLrh+6VSR+N+GTn/7RSbXSEPmwWZHulrLYO4yCg8RoMDGgloKIbBabf X-Received: by 2002:a17:90a:b28b:b0:299:87ba:8a2 with SMTP id c11-20020a17090ab28b00b0029987ba08a2mr11116727pjr.41.1710348667631; Wed, 13 Mar 2024 09:51:07 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710348667; cv=pass; d=google.com; s=arc-20160816; b=AHWK8E97cL4jSfLf1ipk5qvPiAWo3vtEC9ukdBi7Uwcr/k5HJs9H+X32y7KBjBy/A9 RX8Fs37P9uf/RzfZhFRXAwxQ2vNgGMMQrontzKULt/PFl/5PaKV8d3JXpmWbeEBgsIDX eE5FvIiAJVGhKYbWwbjYJf3FBtOUVtmOwx9CoNZ73uvIlOrnaagkXI0kCBcTrlyqfCUp OMnEfRMRajvXrmZhMFkMb0kf2fTb968ZxfDQsuV1NAn196yyRTIpfl3YbXY90DifgOs1 nL+W/CUesV5E9dsmeA8Eo7we8CvDHcZ0UoJZU7BSdzY8jaiSiTQ55RcSKDmf2H5gnYvV Q2Dw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=5sdRrJHYmJrm52GutuDrVN+4RjTZSKVIvXnoe4wwOBg=; fh=QHYoePTVyKNoydmDXmfPR/lPlJYVhXqsBmqXV4JCFVY=; b=xt4/SJvUQnllKbUFSC4V5SjmbvhzS4/YD5lO4zNtvIrCFuRWAa+zjDqqw6vTPQ8DiE d47w4vJ5GiV1eXeqkDHuCFHykq8t8bDiPZFSuZqvavVlwmiJaPQx97lMZ/XUhDzZV3u5 fc375UOGb/0kGMei5oON7xjX0QfQ0L1dN+s47a/xONelm1LaixH7tn8QNjtDuTQrVwWz qRKJ2ir68ewq2QIOhiEi7cBb4ZGjxjs9zlfH/80jUbW1waWsvsZrmvCeYV7I6LqpdVDo veKHOgJBnGUxAWST6sbR+Dm0L4e57QPjO4JSQgPfwIhqw1YrXnG2LOf8Uclr4pv9OmPb bDWw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=qBfCKnqv; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-101797-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-101797-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id qe3-20020a17090b4f8300b0029bc42e99e2si1794354pjb.116.2024.03.13.09.51.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Mar 2024 09:51:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-101797-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=qBfCKnqv; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-101797-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-101797-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 794EFB22DA4 for ; Wed, 13 Mar 2024 16:46:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 87BCC679E1; Wed, 13 Mar 2024 16:34:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="qBfCKnqv" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 988D166B58; Wed, 13 Mar 2024 16:34:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710347652; cv=none; b=lXDEQUjx2Q/EGaIWhNZM75seL18UOlSzFzYIYQNo63Xp45evQ6Wn9PP/nJuTOw5M+mP0m0SjVbsS8BVKlbwecug99QYsiT7s0O10l2lLBN7or3rMNK66AbaHe0N5ta6iRjdHa7xMRk/Llb2fP1pOZ2fTzpsmVVjqNnOP5Ih2wts= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710347652; c=relaxed/simple; bh=+zpnvbgbJoMuGiubEtCUgstrHKkcjtrnNQjXlz0JhXQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=n2BkMPCJuunvzI3xRRVcywoUqTPkUV6BRDM7oEMxhWswjbyMs5ZcPmcc6U0Bkr3XNHM0yd4pB0CYlqfmpLACKn7y65aOAcesRfPxnVA6T7zJYfstDKXpR3v/0QcWp2xp42JsN9s8NrmvTQ0vUnDWlzSa6V+aCvkTOnSPF7wZCW0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=qBfCKnqv; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3085AC43390; Wed, 13 Mar 2024 16:34:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1710347652; bh=+zpnvbgbJoMuGiubEtCUgstrHKkcjtrnNQjXlz0JhXQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qBfCKnqvLFTOOKZl66IK2+boE5tbbv3P5TO12TV224OA00ayyQxLTg+C48RFl7kyM OM04akp0bziHJN0tlIsDDHQAl+stz0v3eUoWkh/Ct7N/rgJkV9eVygBOPvWu3nGWX+ GyVUidwDoxojjh4ju2pmgyYP0QrZE/WldOQI7WlmdJwa0xTuO1Se9cPqAUYIpilRG6 Lffxt7zHf77u1KuySnPRNoAmiuocnzxdWfPMepPywQEZwlaw/3tAaQie+d2sa/y/3n 3J568Cu17zcTnIulmpJt+3ua6tP06Lpi5Yv44BwJ36JdUzVMJKbLEyhImDvq26zxsF kou1dlliJW5Xg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Oleg Nesterov , Dylan Hatch , "Eric W . Biederman" , Andrew Morton , Sasha Levin Subject: [PATCH 6.7 58/61] exit: wait_task_zombie: kill the no longer necessary spin_lock_irq(siglock) Date: Wed, 13 Mar 2024 12:32:33 -0400 Message-ID: <20240313163236.613880-59-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240313163236.613880-1-sashal@kernel.org> References: <20240313163236.613880-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-KernelTest-Patch: http://kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.7.10-rc1.gz X-KernelTest-Tree: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git X-KernelTest-Branch: linux-6.7.y X-KernelTest-Patches: git://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git X-KernelTest-Version: 6.7.10-rc1 X-KernelTest-Deadline: 2024-03-15T16:32+00:00 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit From: Oleg Nesterov [ Upstream commit c1be35a16b2f1fe21f4f26f9de030ad6eaaf6a25 ] 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. Link: https://lkml.kernel.org/r/20240123153359.GA21866@redhat.com Signed-off-by: Oleg Nesterov Signed-off-by: Dylan Hatch Cc: Eric W. Biederman Cc: Signed-off-by: Andrew Morton Signed-off-by: Sasha Levin --- kernel/exit.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/kernel/exit.c b/kernel/exit.c index aedc0832c9f4d..0c4858581c98c 100644 --- a/kernel/exit.c +++ b/kernel/exit.c @@ -1125,17 +1125,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; @@ -1158,8 +1155,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.43.0