Re: [PATCH v3 3/3] perf tool: add cgroup identifier entry in perf report
From: Eric W. Biederman
Date: Tue Dec 13 2016 - 15:00:04 EST
Hari Bathini <hbathini@xxxxxxxxxxxxxxxxxx> writes:
> Hi Eric,
> On Tuesday 13 December 2016 03:36 AM, Eric W. Biederman wrote:
>> Hari Bathini <hbathini@xxxxxxxxxxxxxxxxxx> 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..?
Inode numbers in general are 64bit. The namespace inodes admittedly are
currently implemented as 32bit quantities but that is not something we
want to hard code into the userspace interface.
I would just make the identifier a structure containing the
device number and the inode number. It didn't look like perf required
the identifier to be a simple integer.