[PATCH 0/2] cgroup: Sync cgroup id and inode number

From: Namhyung Kim
Date: Wed Oct 16 2019 - 08:50:28 EST


Hello,

This patchset changes cgroup inode number and id management to be in
sync with kernfs. Currently cgroup inode is managed by kernfs while
cgroup id is allocated by its own idr. And kernfs/cgroup file handle
uses inode and generation numbers. So I added generation number to
cgroup and pass the numbers to kernfs.

The background of this work is that I want to add cgroup sampling
feature in the perf event subsystem. As Tejun mentioned that using
cgroup id is not enough and it'd better using file handle instead.
But getting file handle in perf NMI handler is not possible so I want
to get the info from a cgroup node.

The first patch added generation number to cgroup and the second patch
allows kernfs node created with external generation and inode numbers.

The patches are based on the for-next branch in Tejun's cgroup tree.
Tested with tools/testing/selftests/cgroup/test_stress.sh.

Thanks
Namhyung


Namhyung Kim (2):
cgroup: Add generation number with cgroup id
kernfs: Allow creation with external gen + ino numbers

arch/x86/kernel/cpu/resctrl/rdtgroup.c | 4 +-
fs/kernfs/dir.c | 63 +++++++++++++++++------
fs/kernfs/file.c | 9 ++--
fs/kernfs/kernfs-internal.h | 5 ++
fs/sysfs/file.c | 2 +-
include/linux/cgroup-defs.h | 12 ++++-
include/linux/kernfs.h | 25 ++++++---
kernel/cgroup/cgroup.c | 70 +++++++++++++++++++-------
8 files changed, 143 insertions(+), 47 deletions(-)

--
2.23.0.700.g56cf767bdb-goog