Re: [PATCH v3 3/3] perf tool: add cgroup identifier entry in perf report

Hari Bathini
2016-12-13T19:08:17Z

Hi Eric,

On Tuesday 13 December 2016 03:36 AM, Eric W. Biederman wrote:
> Hari Bathini <hbathini@linux.vnet.ibm.com> writes:
>
>> This patch introduces a cgroup identifier entry field in perf report to
>> identify or distinguish data of different cgroups. It uses the unique
>> inode number of cgroup namespace, included in perf data with the new
>> PERF_RECORD_NAMESPACES event, as cgroup identifier. With the assumption
>> that each container is created with it's own cgroup namespace, this
>> allows assessment/analysis of multiple containers at once.
> In the large this sounds reasonable.
>
> The details are wrong. The cgroup id needs to be device
> number + inode number, not just inode number.
>

As the assumption that device number is going to be the same for
all namespaces may not stand the test of time, the inode number is
not going to be unique, to use as an identifier..

I am thinking of an identifier like the below. This may be OK for now
as dev_num & inode_num are 32bit each.

identifier = (dev_num << 32 | inode_num)

But this may leave us with identifiers that are not unique if dev_num
& inode_num are changed to 64bit. Should that be of concern? Do
you have any alternate suggestions to come up with unique identifier
in such scenario too..?

Thanks
Hari