All of lore.kernel.org
 help / color / mirror / Atom feed
From: "tip-bot2 for Chengming Zhou" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Chengming Zhou <zhouchengming@bytedance.com>,
	"Peter Zijlstra (Intel)" <peterz@infradead.org>,
	x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [tip: perf/urgent] perf/core: Use perf_cgroup_info->active to check if cgroup is active
Date: Tue, 05 Apr 2022 08:29:04 -0000	[thread overview]
Message-ID: <164914734415.389.1917067665654461073.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20220329154523.86438-3-zhouchengming@bytedance.com>

The following commit has been merged into the perf/urgent branch of tip:

Commit-ID:     6875186aea5ce09a644758d9193265da1cc187c7
Gitweb:        https://git.kernel.org/tip/6875186aea5ce09a644758d9193265da1cc187c7
Author:        Chengming Zhou <zhouchengming@bytedance.com>
AuthorDate:    Tue, 29 Mar 2022 23:45:21 +08:00
Committer:     Peter Zijlstra <peterz@infradead.org>
CommitterDate: Tue, 05 Apr 2022 09:59:45 +02:00

perf/core: Use perf_cgroup_info->active to check if cgroup is active

Since we use perf_cgroup_set_timestamp() to start cgroup time and
set active to 1, then use update_cgrp_time_from_cpuctx() to stop
cgroup time and set active to 0.

We can use info->active directly to check if cgroup is active.

Signed-off-by: Chengming Zhou <zhouchengming@bytedance.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lore.kernel.org/r/20220329154523.86438-3-zhouchengming@bytedance.com
---
 kernel/events/core.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/kernel/events/core.c b/kernel/events/core.c
index 6545020..a08fb92 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -780,7 +780,6 @@ static inline void update_cgrp_time_from_cpuctx(struct perf_cpu_context *cpuctx,
 static inline void update_cgrp_time_from_event(struct perf_event *event)
 {
 	struct perf_cgroup_info *info;
-	struct perf_cgroup *cgrp;
 
 	/*
 	 * ensure we access cgroup data only when needed and
@@ -789,14 +788,12 @@ static inline void update_cgrp_time_from_event(struct perf_event *event)
 	if (!is_cgroup_event(event))
 		return;
 
-	cgrp = perf_cgroup_from_task(current, event->ctx);
+	info = this_cpu_ptr(event->cgrp->info);
 	/*
 	 * Do not update time when cgroup is not active
 	 */
-	if (cgroup_is_descendant(cgrp->css.cgroup, event->cgrp->css.cgroup)) {
-		info = this_cpu_ptr(event->cgrp->info);
+	if (info->active)
 		__update_cgrp_time(info, perf_clock(), true);
-	}
 }
 
 static inline void

  reply	other threads:[~2022-04-05 10:30 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-29 15:45 [PATCH v4 0/4] perf/core: Fixes for cgroup events Chengming Zhou
2022-03-29 15:45 ` [PATCH v4 1/4] perf/core: Don't pass task around when ctx sched in Chengming Zhou
2022-04-05  8:29   ` [tip: perf/urgent] " tip-bot2 for Chengming Zhou
2022-03-29 15:45 ` [PATCH v4 2/4] perf/core: Use perf_cgroup_info->active to check if cgroup is active Chengming Zhou
2022-04-05  8:29   ` tip-bot2 for Chengming Zhou [this message]
2022-03-29 15:45 ` [PATCH v4 3/4] perf/core: Fix perf_cgroup_switch() Chengming Zhou
2022-04-05  8:29   ` [tip: perf/urgent] " tip-bot2 for Chengming Zhou
2022-03-29 15:45 ` [PATCH v4 4/4] perf/core: Always set cpuctx cgrp when enable cgroup event Chengming Zhou
2022-04-05  8:29   ` [tip: perf/urgent] " tip-bot2 for Chengming Zhou
2022-03-31  8:14 ` [PATCH v4 0/4] perf/core: Fixes for cgroup events Peter Zijlstra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=164914734415.389.1917067665654461073.tip-bot2@tip-bot2 \
    --to=tip-bot2@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=x86@kernel.org \
    --cc=zhouchengming@bytedance.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.