Received: by 2002:ab2:710b:0:b0:1ef:a325:1205 with SMTP id z11csp1873259lql; Wed, 13 Mar 2024 10:23:21 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCULvmYm3jeMY1fq23lQ8as6gqa5LBULlNaamSvJizPRJmD9N5gVmJ/tYZvjKfq+LS1EkpLwLsRrLMm+5qilttApEXi56PdPOSriAEU6wg== X-Google-Smtp-Source: AGHT+IECBqHUGhbE+ic4Ac68tghdKJx6s9Q9Y1HuSDB1th+NwcgYHofaqT4geenziQnG/PmmEeVn X-Received: by 2002:a17:906:f156:b0:a46:4800:123e with SMTP id gw22-20020a170906f15600b00a464800123emr2565294ejb.73.1710350601157; Wed, 13 Mar 2024 10:23:21 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710350601; cv=pass; d=google.com; s=arc-20160816; b=wN/txj1X981Ss7HDZLNzPGM3muvuvTblWTInlfXPSfTEl+aYyKQaV+rtHmtuhL7cFG XGc3YXTM+eVafrHCLruzQ084Ogboi8TpTslWte+i4A8qwkxK73X8hpRS9/A9G0ydiAue /aRKWB0pjJIM+YJ0CzIHhJZsXmF/lNiYJO0j+1u7c+H3wb7pisZyuOcwxrp+WKs1jgfg RR9bMYeqoj3QbQbTfXTF2uR1jVDMaC72zcZbuq0chav8LYSXPspJsaYhiQTW9UcK+GqS KyltlPNTgCV/pfxSqqd9aFsOdNc/qUgoLdrmImzWcXm2ymIphqDbRg3SjZKcH4yfwkoh L8WA== 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=Sce4cT0CaYhCoDiKR39BUWRiw1ulW7G8gjdbOnHPuBU=; fh=QHYoePTVyKNoydmDXmfPR/lPlJYVhXqsBmqXV4JCFVY=; b=Y+IitNqwWZclCbCxn4YW2UDaZRczkO2U3uPjwFR1j5ZFXVKljhNXJa6QAM128LzxTJ jlpjjs/bYoR7XIrh4OiTF1OhtD5Ybg/NpILS927fM2OvzBK7yqY1vK+PYzQ6pDyCtTID Nxu1u3UmpQTkBB1pCd7I29dYqq0b78h0vCAGblU4lbV94zthJbZP8iNY6BqRGhTrxp9y 1jNS9GVXfthMGilmj8TJgOqa57Dlmb8eoPOFGzz02yoQkeF71TThEP+nMVsFLTa9Zbk2 iSvvYV03f3+D2CbCNUDUiKbCtjnZKAQOToooW8kyl8AC/nI5kjE9I9GWFp5QMnDyUUnu TYcA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=hG+dTlTv; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-101936-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-101936-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id u16-20020a1709064ad000b00a45ffbef23bsi4621841ejt.33.2024.03.13.10.23.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Mar 2024 10:23:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-101936-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=hG+dTlTv; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-101936-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-101936-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 5C5361F26FAF for ; Wed, 13 Mar 2024 17:19:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E60B1134415; Wed, 13 Mar 2024 16:41:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="hG+dTlTv" 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 0DF426216A; Wed, 13 Mar 2024 16:41:20 +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=1710348081; cv=none; b=FU7kaKkIj7FIJ67YI1X0aLwe2AmfgGae2cb4rH2xDpjlNowP6+ZoYsQeiWz4ywg+0hvtrIQwxv9Mg5mlgDj0Jjv0yFCNZfJJhZqO5n/CALiC13IxiseKzcFWcyglCf8LYEAuVrEauN6oHPZQ4O2+6ZL2QAF4KRWz3zK4Eovw3Qc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710348081; c=relaxed/simple; bh=JekPTn1M8RBIDjsbBIOJ2GWI5om46RCDvDs6dVZPLME=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=WKMbiV6TfK3q9xbQuNAg1MnSrAn8+b0CH75AhiGxKs074dpqCt3OZSWQ4a25Gw6OgqSaQQ9/nTwZJ1FCfoMOtPzyzQmJtPo4FZaSCm0W05lgZI553oN2q9pW4gi4SuFZ6b2GdeHO0qjn6ijrpHHios4M4v5pRCb7NW3a8UvauVA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=hG+dTlTv; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8BCE6C43390; Wed, 13 Mar 2024 16:41:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1710348080; bh=JekPTn1M8RBIDjsbBIOJ2GWI5om46RCDvDs6dVZPLME=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hG+dTlTv/hnvvhA5fVUMYNBmnlXbk/8I18qFuRs3dKlNOBTmwIe+cxo2IQkF6+V0y yDXwwCiAFTQ9aJKhhFyOu18M6aHNPwvrvMPn3TgS/I7yJ5f05hX59/3/sig32yuj5S 5x8a/2JSCWx0UwvXuGxvPp0vUmTry3Dezw3npkLounSog/p2mOs2/np41QrToTqkZF G+oAlmMA2k9C7K7CtofYfZV4huSE9ScUp93alOyvMavMuZacKzUJveZKgt+RBlfjDU zlgV+6PQFW6II7b/QfjMyrq8+RWMF9Jut1vYBfVBlmgNYbvGCmAWzgL+C9eIrtFzCT Hm6Ae5owRLQCg== 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.1 68/71] exit: wait_task_zombie: kill the no longer necessary spin_lock_irq(siglock) Date: Wed, 13 Mar 2024 12:39:54 -0400 Message-ID: <20240313163957.615276-69-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240313163957.615276-1-sashal@kernel.org> References: <20240313163957.615276-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.1.82-rc1.gz X-KernelTest-Tree: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git X-KernelTest-Branch: linux-6.1.y X-KernelTest-Patches: git://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git X-KernelTest-Version: 6.1.82-rc1 X-KernelTest-Deadline: 2024-03-15T16:39+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 bccfa4218356e..c95fffc625fcd 100644 --- a/kernel/exit.c +++ b/kernel/exit.c @@ -1146,17 +1146,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; @@ -1179,8 +1176,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