Received: by 2002:ab2:710b:0:b0:1ef:a325:1205 with SMTP id z11csp1888354lql; Wed, 13 Mar 2024 10:54:20 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUgUPDOXst+XE1fGkoQk/OjK/KXu/8+9VyhtjWmmnzY6b+nTVvwZtlih3udGkuuTlyPHTYkP+7ambBAxfUrSf+PGlE5svO22GlNcAFhNw== X-Google-Smtp-Source: AGHT+IHutK6BQHpJMMdWLDQyJIDdNZ/4gcj96HorOC0PknUaL9GzW16hyZUfrpJYxJSdxjQXGEv+ X-Received: by 2002:a05:6a00:1d83:b0:6e6:a43c:f27e with SMTP id z3-20020a056a001d8300b006e6a43cf27emr3846015pfw.1.1710352460585; Wed, 13 Mar 2024 10:54:20 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710352460; cv=pass; d=google.com; s=arc-20160816; b=tKoTmSMqJ3LiTrJyiCeS/8iTD1gYAsQgour7hUcqhKDFARZRQNvNaGELXZU1q+qZY4 gbs6IXJasT5DLDwbAMol9ycU95VT1/WmhU1jZc1Wa0GtFywQ9W3x7El24m/LpBuGwAjS ofvpmVUwKObSlaXee95x0IhWz2BeQHWWKGhCgNoFoHtZwIi4pIDcuknfN3BJQ6r2J5Zz FgFFNL8qyWK/67hpJW9EjnyF8PeYRCZSki8ZvavlZmIZUPM6bx7MUBaLZWIE85lg7pZK X7Houw6gFPu0k3YHE6vvsZewLx3cHA1ju8zH7ZEtoGDCbviL0hJ36qHSrt/c40pIUEyw cv7g== 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=cVPlZNjEQ+NAHRq/NWkXlY+3SXiTF6JsYovksXCHvH4=; fh=icD+R5m4IzvSLoLsxP3Odku2KGYbuGNa4JGfYzcZLwA=; b=fPfxjjwmz0m5UiLLFP3S7vYbFDMl8WaqUSK6fOpewxWgY5j1kFiVRAfouW8+m3Nvyl J9Ygeoivp/jpvN+XO05/DQ4F6oeNyvE07XHPQAreqHvtZNA1S4x1CPolp8Z6/9DGdoL6 dRueDVGK3zVM4Mb1xeKjS51HPWnSLZ2+otWws+gQTzBbHHSwn7Xud/f3WqQ2OYTDCEqP Qt8SQjqeBoVQkZGNSrgLQfSTwpV7HykpQdp9O86Ysql9p1KYeMFKqHztCWkFgBsDpw+W vPzN0wFV+aShpw8pnO4ViB8Ty86wZKE4DchhpYyKMtMf7O0WZxC/xcYlOFxrJMF65Y6L CSaA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=aaqnsgmT; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-102086-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-102086-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id c4-20020a637244000000b005c65d0dd99fsi9410422pgn.505.2024.03.13.10.54.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Mar 2024 10:54:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-102086-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=aaqnsgmT; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-102086-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-102086-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 453332823C3 for ; Wed, 13 Mar 2024 17:54:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F2CAB6FE39; Wed, 13 Mar 2024 16:47:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="aaqnsgmT" 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 17FE36FE1E; Wed, 13 Mar 2024 16:47:50 +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=1710348470; cv=none; b=CBQDsBo2be55hJjAtzKmoQOOg8Ak3NbkjCjAxSf2hpTiJi+TUmuRdDWdQni4N22DC3uRkN9Vq5lLbnyBkig+Gbtk+Qq7LKE6mIwZyfRq5c+4oe9BotaUrUrZHl0yqMuD2xzlE2hKU+LusmlksdnUojfnZaeygDDNHoM1WqLOLSQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710348470; c=relaxed/simple; bh=nOLn3S4rg43w66t96mcY9QG+VPaxgLbxU/EajpfW+A0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QJvNNb0F8ePOa3yOZ1rCyq4SJOpQo1cHlvrrymcTbEdh7RQPkvkQXt68oiDkZ3YNS13K5uWx+ppzxNNQMWVAtXVUImSmloqjcgkAHCv/rdlYDovTHlam4qQcTW5PNW/OPHOSr5ON18EHz7s51gtotqdM/KKM5ywEA6NdncSr6jA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=aaqnsgmT; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 25DDBC433C7; Wed, 13 Mar 2024 16:47:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1710348470; bh=nOLn3S4rg43w66t96mcY9QG+VPaxgLbxU/EajpfW+A0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aaqnsgmTZtTPPNJBRdbNzaGZcJZtxWQvmiWZaJUOmLEwsPb2BkoyRtLRlL7LsWeP/ hXAQL3K8QA9lER3DKHxRxTN+3qq875VzKSqOaIXQ3OKz1153OFUf0uOU3G9N7raP64 yLsXjGAboZoYw/KCa2VVXF5Tn5Ji6g9FwU7kiyRdeaUWjBtMKyd9fXkb1InjJUtLOa IcZfNUZminIXTl+PtWqvVLXf7XT+5YtccqpUZnGDHb1l+resG9JRxjI6eRxHizWcLA Dle7pmRjP5b7zXtR0i6E9wKdIZYrPSl1cnX4tXmnlipr9Nl3ac5KJgRq5Qo/k9Ok7Q 4ieYMiU3X0t7Q== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Oleg Nesterov , "Eric W . Biederman" , Andrew Morton , Sasha Levin Subject: [PATCH 5.10 60/73] getrusage: add the "signal_struct *sig" local variable Date: Wed, 13 Mar 2024 12:46:27 -0400 Message-ID: <20240313164640.616049-61-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240313164640.616049-1-sashal@kernel.org> References: <20240313164640.616049-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.10.213-rc1.gz X-KernelTest-Tree: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git X-KernelTest-Branch: linux-5.10.y X-KernelTest-Patches: git://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git X-KernelTest-Version: 5.10.213-rc1 X-KernelTest-Deadline: 2024-03-15T16:46+00:00 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit From: Oleg Nesterov [ Upstream commit c7ac8231ace9b07306d0299969e42073b189c70a ] No functional changes, cleanup/preparation. Link: https://lkml.kernel.org/r/20230909172554.GA20441@redhat.com Signed-off-by: Oleg Nesterov Cc: Eric W. Biederman Signed-off-by: Andrew Morton Stable-dep-of: daa694e41375 ("getrusage: move thread_group_cputime_adjusted() outside of lock_task_sighand()") Signed-off-by: Sasha Levin --- kernel/sys.c | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/kernel/sys.c b/kernel/sys.c index bff14910b9262..8a53d858d7375 100644 --- a/kernel/sys.c +++ b/kernel/sys.c @@ -1737,6 +1737,7 @@ void getrusage(struct task_struct *p, int who, struct rusage *r) unsigned long flags; u64 tgutime, tgstime, utime, stime; unsigned long maxrss = 0; + struct signal_struct *sig = p->signal; memset((char *)r, 0, sizeof (*r)); utime = stime = 0; @@ -1744,7 +1745,7 @@ void getrusage(struct task_struct *p, int who, struct rusage *r) if (who == RUSAGE_THREAD) { task_cputime_adjusted(current, &utime, &stime); accumulate_thread_rusage(p, r); - maxrss = p->signal->maxrss; + maxrss = sig->maxrss; goto out; } @@ -1754,15 +1755,15 @@ void getrusage(struct task_struct *p, int who, struct rusage *r) switch (who) { case RUSAGE_BOTH: case RUSAGE_CHILDREN: - utime = p->signal->cutime; - stime = p->signal->cstime; - r->ru_nvcsw = p->signal->cnvcsw; - r->ru_nivcsw = p->signal->cnivcsw; - r->ru_minflt = p->signal->cmin_flt; - r->ru_majflt = p->signal->cmaj_flt; - r->ru_inblock = p->signal->cinblock; - r->ru_oublock = p->signal->coublock; - maxrss = p->signal->cmaxrss; + utime = sig->cutime; + stime = sig->cstime; + r->ru_nvcsw = sig->cnvcsw; + r->ru_nivcsw = sig->cnivcsw; + r->ru_minflt = sig->cmin_flt; + r->ru_majflt = sig->cmaj_flt; + r->ru_inblock = sig->cinblock; + r->ru_oublock = sig->coublock; + maxrss = sig->cmaxrss; if (who == RUSAGE_CHILDREN) break; @@ -1772,14 +1773,14 @@ void getrusage(struct task_struct *p, int who, struct rusage *r) thread_group_cputime_adjusted(p, &tgutime, &tgstime); utime += tgutime; stime += tgstime; - r->ru_nvcsw += p->signal->nvcsw; - r->ru_nivcsw += p->signal->nivcsw; - r->ru_minflt += p->signal->min_flt; - r->ru_majflt += p->signal->maj_flt; - r->ru_inblock += p->signal->inblock; - r->ru_oublock += p->signal->oublock; - if (maxrss < p->signal->maxrss) - maxrss = p->signal->maxrss; + r->ru_nvcsw += sig->nvcsw; + r->ru_nivcsw += sig->nivcsw; + r->ru_minflt += sig->min_flt; + r->ru_majflt += sig->maj_flt; + r->ru_inblock += sig->inblock; + r->ru_oublock += sig->oublock; + if (maxrss < sig->maxrss) + maxrss = sig->maxrss; t = p; do { accumulate_thread_rusage(t, r); -- 2.43.0