public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Li Zefan <lizf@cn.fujitsu.com>
To: Stephane Eranian <eranian@google.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
	linux-kernel@vger.kernel.org, mingo@elte.hu, paulus@samba.org,
	davem@davemloft.net, fweisbec@gmail.com,
	perfmon2-devel@lists.sf.net, eranian@gmail.com,
	robert.richter@amd.com, acme@redhat.com,
	Paul Menage <menage@google.com>
Subject: Re: [PATCH 1/2] perf_events: add cgroup support (v8)
Date: Fri, 11 Feb 2011 08:55:32 +0800	[thread overview]
Message-ID: <4D548904.9000003@cn.fujitsu.com> (raw)
In-Reply-To: <AANLkTingFKyux-u6Aw8jg=cKca7QV7bQEHjDzC-4Dg04@mail.gmail.com>

>>> while there is already cgroup monitoring active. In that case and if we do not
>>> want to wait until there is at least one ctxsw on all CPUs, then we have to
>>> check if the other threads are not already running on the other CPUs.If so,
>>> we need to do a cgroup switch on those CPUs. Otherwise, we have nothing to
>>> do. Am I getting this right?
>>
>> Right, so if any of those tasks is currently running, that cpu will be
>> monitoring their old cgroup, hence we send an IPI to flip cgroups.
>>
> I have built a test case where this would trigger. I launched a multi-threaded
> app, and then I move the pid into a cgroup via: echo PID >/cgroup/tests/tasks.
> I don't see any perf_cgroup move beyond the PID passed.
> 
> I looked at kernel/cgroup.c and I could not find a invocation of
> ss->attach() that
> would pass threadgroup = true. So I am confused here.
> 
> I wonder how the cgroupfs 'echo PID >tasks' interface would make the distinction
> between PID and TID. It seems possible to move one thread of a multi-threaded
> process into a cgroup but not the others.
> 

You can do this:

	# echo PID > cgroup.procs

When the patchset that implements the above feature is accepted. See:

	https://lkml.org/lkml/2011/2/7/418

The below commit that confused you is actually a part of the above patchset,
but it sneaked into the kernel accidentally:

commit be367d09927023d081f9199665c8500f69f14d22
Author: Ben Blum <bblum@google.com>
Date:   Wed Sep 23 15:56:31 2009 -0700

    cgroups: let ss->can_attach and ss->attach do whole threadgroups at a time

  reply	other threads:[~2011-02-11  0:54 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-20 13:30 [PATCH 1/2] perf_events: add cgroup support (v8) Stephane Eranian
2011-01-20 14:39 ` Peter Zijlstra
2011-01-20 14:46   ` Stephane Eranian
2011-02-02 11:29   ` Peter Zijlstra
2011-02-02 11:50     ` Balbir Singh
2011-02-02 12:46       ` Peter Zijlstra
2011-02-02 19:02         ` Balbir Singh
2011-02-07 16:10           ` [RFC][PATCH] cgroup: Fix cgroup_subsys::exit callback Peter Zijlstra
2011-02-07 19:28             ` Paul Menage
2011-02-07 20:02               ` Peter Zijlstra
2011-02-07 21:21                 ` Paul Menage
2011-02-08 10:24                   ` Peter Zijlstra
2011-02-10  2:04                     ` Li Zefan
2011-02-11 12:13                       ` Peter Zijlstra
2011-02-14  4:32                     ` Paul Menage
2011-02-16 13:46                     ` [tip:perf/core] " tip-bot for Peter Zijlstra
2011-02-13 12:52             ` [RFC][PATCH] " Balbir Singh
2011-02-07 19:29         ` [PATCH 1/2] perf_events: add cgroup support (v8) Paul Menage
2011-02-07 20:09           ` Peter Zijlstra
2011-02-07 21:33             ` Paul Menage
2011-02-07 16:10 ` Peter Zijlstra
2011-02-07 20:30   ` Stephane Eranian
2011-02-08 22:31   ` Stephane Eranian
2011-02-09  9:47     ` Peter Zijlstra
2011-02-10 11:47       ` Stephane Eranian
2011-02-11  0:55         ` Li Zefan [this message]
2011-02-11  9:56           ` Stephane Eranian
2011-02-11 13:36             ` Stephane Eranian

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=4D548904.9000003@cn.fujitsu.com \
    --to=lizf@cn.fujitsu.com \
    --cc=acme@redhat.com \
    --cc=davem@davemloft.net \
    --cc=eranian@gmail.com \
    --cc=eranian@google.com \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=menage@google.com \
    --cc=mingo@elte.hu \
    --cc=paulus@samba.org \
    --cc=perfmon2-devel@lists.sf.net \
    --cc=peterz@infradead.org \
    --cc=robert.richter@amd.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