lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <AANLkTimSJoysRq5axhA7XqRRr8FZqOd5JfgTWemf5ZQc@mail.gmail.com>
Date:	Fri, 11 Feb 2011 14:36:18 +0100
From:	Stephane Eranian <eranian@...gle.com>
To:	Li Zefan <lizf@...fujitsu.com>
Cc:	Peter Zijlstra <peterz@...radead.org>,
	linux-kernel@...r.kernel.org, mingo@...e.hu, paulus@...ba.org,
	davem@...emloft.net, fweisbec@...il.com,
	perfmon2-devel@...ts.sf.net, eranian@...il.com,
	robert.richter@....com, acme@...hat.com,
	Paul Menage <menage@...gle.com>
Subject: Re: [PATCH 1/2] perf_events: add cgroup support (v8)

On Fri, Feb 11, 2011 at 10:56 AM, Stephane Eranian <eranian@...gle.com> wrote:
> Li,
>
> On Fri, Feb 11, 2011 at 1:55 AM, Li Zefan <lizf@...fujitsu.com> wrote:
>>>>> 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@...gle.com>
>> Date:   Wed Sep 23 15:56:31 2009 -0700
>>
>>    cgroups: let ss->can_attach and ss->attach do whole threadgroups at a time
>>
> Ok, that makes more sense now. I wil try with the above patchset applied to
> verify this work as expected.
>
The above patchset seems to work fine. I add to switch perf_event from
ss->attach() to ss->attach_task() to make it work with multi-threaded apps.
The good thing is that it simplifies the code, because all we have to do now
is simply call perf_cgroup_move(). The caller does the thread iteration.

During this exercise, I found a minor issue in event_sched_out() with the
current perf cgroup patch. I will resubmit the patch incl. Peter's changes
+ some more cleanups and the fix + the update perf cgroup patch.

Thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ