Received: by 2002:ab2:710b:0:b0:1ef:a325:1205 with SMTP id z11csp1881607lql; Wed, 13 Mar 2024 10:39:48 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUs96N18TdR0oMVuFL4QHsFwJgjS4VHKIalLRh12DTK5Sd0NhxUQNCOvQUfeoKkYhkvwEk+grVgtA9yr7CMa1WoYf6rwG/gltBun2dFaQ== X-Google-Smtp-Source: AGHT+IG2oAQGVHlveDAlWjuyCpec0ZoYPEUnXYYjchZMtVUAtcRYMMWMLZXuRW5Y9blqqbPVTOQe X-Received: by 2002:a50:8a98:0:b0:565:9e16:60da with SMTP id j24-20020a508a98000000b005659e1660damr3094542edj.30.1710351588107; Wed, 13 Mar 2024 10:39:48 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710351588; cv=pass; d=google.com; s=arc-20160816; b=FlyPLxD/klL3EgXUn8FgePMRe3lcLw0BMxI9FqWrdX1uT/sHjyGFEZ6A9MJnQFoWBK dVpYtIHt9Sg4dT2eCpqyoWP4iJAdar/87G3T562pIA456T2ZdVFT9C6IazE1Ie1bQMPJ jJZ6lRpmCxKwGxYON/eKUup4uDIgSqivKqYkpQhQWKaOvtLgSV9begMssxq05cEAgAdc /1PAb9WV06seEIUDqhIIIWBf0MRVv66Je5DKl3hM4183slYk0yRREN7GMsHOOMgOyX6F DaV/HEsSEekqnC1Qbcn5CP38hkZDlj0S+Ym9xtSOaKr438iXvaBArGoDJOgEkNFFLTeq ghpA== 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=weLdOAuRkOzDQinj9Ja0fUjce9Dli7TCzfLX3INQYvc=; fh=QHYoePTVyKNoydmDXmfPR/lPlJYVhXqsBmqXV4JCFVY=; b=NrVbNWPh3qHKdpNgAY3aIsT9IucaG/TdIIaptPUYDSNgj+UDgTCPZViv4ToKAdBXBC dR7C+ogm4fE92eRhw4h2I9omwGBR0NrQvJ3sSuVy48xLeDWaT/5ZIKuVJS/FilLoncKj saZxsqfGD9dedwRGNWgl67bwRTQnJUIYuHkMKvC0/mhp0Mwc1/LQW5VN5m/7J51TGy11 qcqq72Fi+7ScabbgKf4PW1iGP4L+vQii89s7VIV+5lzKBbohOuAQzDtc3legyGL6z9zA YsKAB/NVFT35JBMeoUtbKxLx7AzdS5EKSsVQ88j42HgUTt8kHuLCfTpU7k+hJzReJWra 28Sg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="o7TY/Ia2"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-102008-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-102008-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. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id m15-20020a056402510f00b00568308c03e5si4691311edd.68.2024.03.13.10.39.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Mar 2024 10:39:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-102008-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="o7TY/Ia2"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-102008-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-102008-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 1B7AB1F25B37 for ; Wed, 13 Mar 2024 17:37:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4453C14CAD5; Wed, 13 Mar 2024 16:43:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="o7TY/Ia2" 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 5AC6D64CEF; Wed, 13 Mar 2024 16:43:41 +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=1710348221; cv=none; b=NE+lHSxefdICLwsgvWNnx12z6ET0HxUQSLEcX7eeTHOBSqqeG/4oTLSLy5pZnmP94AFgeIj1cLYMw5V6VihSoBSf4OAhc+oD8QkWIkXKbtz87+pgaps1w7kS3mwa35MasG9niZcOTwp22CC2jeODeP9S7bYtCFcb8ZTB0Y2YSxM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710348221; c=relaxed/simple; bh=WAUj8o87Jtl9FY8pDymI7DWVAEqnJiixd48oKquu4iI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SeyYb92Hyq0eW9gsdfE3xx0sQBIIRwFS/aIH4Q+1WNpL/bVTqK8yYC/y10y5GsXLFDWO07hVZP1HOtk0eLgoOUiWq3Jh/2QQXT+GinBTITL61qRB5DMcPc77EqlqRb9+OlLOfHGLY/NwQH4qpSsYPScny3NiKyiyxXlGOIe9BSI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=o7TY/Ia2; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4F1D7C433C7; Wed, 13 Mar 2024 16:43:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1710348221; bh=WAUj8o87Jtl9FY8pDymI7DWVAEqnJiixd48oKquu4iI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=o7TY/Ia2kdis+532dlECAIEuQdXX6Oj/lZoreuoVRvGf0a9AhK0ra/IR3EMdewWHe msy4j4uXbo2mCzFS0USbOury7NGEu6AYwWrO3Pi1CM7W2TBDPU7BKyJ6vgjJYQeFLX vyDovPuRQji7/4DhbqzpUcDJlxztGR5qDSa5O711JsnwXEkTaVMjnOpAf/jukj5pcm RlOOxe1djo70tVsWox/2JvVkaWMEup04LxJF/C+uwOyWedYoYPYq/fp7p2WqrRaTFJ aPmp5vGTOsdmJId5ia6WDKnRgs6LdQBpdgUxxGXbYv4udrYCK2dXTodxPhfGgyNtmc njiet83lDu1zQ== 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 5.15 67/76] exit: wait_task_zombie: kill the no longer necessary spin_lock_irq(siglock) Date: Wed, 13 Mar 2024 12:42:14 -0400 Message-ID: <20240313164223.615640-68-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240313164223.615640-1-sashal@kernel.org> References: <20240313164223.615640-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/v5.x/stable-review/patch-5.15.152-rc1.gz X-KernelTest-Tree: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git X-KernelTest-Branch: linux-5.15.y X-KernelTest-Patches: git://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git X-KernelTest-Version: 5.15.152-rc1 X-KernelTest-Deadline: 2024-03-15T16:42+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 e982111c489a9..85baaa31b2997 100644 --- a/kernel/exit.c +++ b/kernel/exit.c @@ -1120,17 +1120,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; @@ -1153,8 +1150,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