public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: linxiulei@gmail.com
To: yang_oliver@hotmail.com, peterz@infradead.org, mingo@redhat.com,
	acme@kernel.org, alexander.shishkin@linux.intel.com,
	linux-kernel@vger.kernel.org, tglx@linutronix.de,
	eranian@gmail.com, torvalds@linux-foundation.org,
	jolsa@redhat.com
Cc: "leilei.lin" <leilei.lin@alibaba-inc.com>
Subject: [PATCH] perf/core: Update cgroup time with descendants
Date: Thu, 14 Sep 2017 15:03:57 +0800	[thread overview]
Message-ID: <20170914070357.29288-1-linxiulei@gmail.com> (raw)

From: "leilei.lin" <leilei.lin@alibaba-inc.com>

This fix updating cgroup time when event is being scheduled in
by cgroup descendants

Signed-off-by: leilei.lin <leilei.lin@alibaba-inc.com>
---
 kernel/events/core.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/kernel/events/core.c b/kernel/events/core.c
index 3e691b7..6f6bd1e 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -662,7 +662,9 @@ static inline void update_cgrp_time_from_event(struct perf_event *event)
 	/*
 	 * Do not update time when cgroup is not active
 	 */
-	if (cgrp == event->cgrp)
+	if (cgrp == event->cgrp ||
+		cgroup_is_descendant(cgrp->css.cgroup,
+			event->cgrp->css.cgroup))
 		__update_cgrp_time(event->cgrp);
 }
 
-- 
2.8.4.31.g9ed660f

             reply	other threads:[~2017-09-14  7:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-14  7:03 linxiulei [this message]
2017-09-19  2:02 ` [PATCH] perf/core: Update cgroup time with descendants Lin Xiulei
2017-09-19  8:48   ` Jiri Olsa

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=20170914070357.29288-1-linxiulei@gmail.com \
    --to=linxiulei@gmail.com \
    --cc=acme@kernel.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=eranian@gmail.com \
    --cc=jolsa@redhat.com \
    --cc=leilei.lin@alibaba-inc.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=yang_oliver@hotmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox