cgroup: Add a new helper for cgroup1 hierarchy
authorYafang Shao <laoar.shao@gmail.com>
Sun, 29 Oct 2023 06:14:32 +0000 (06:14 +0000)
committerTejun Heo <tj@kernel.org>
Thu, 9 Nov 2023 23:25:47 +0000 (13:25 -1000)
commitaecd408b7e50742868b3305c24325a89024e2a30
treecef667773cd2ee6e9880ef19f62d0a02562dada6
parent0008454e8fd30ed0017a9a35b8dd708f168931b8
cgroup: Add a new helper for cgroup1 hierarchy

A new helper is added for cgroup1 hierarchy:

- task_get_cgroup1
  Acquires the associated cgroup of a task within a specific cgroup1
  hierarchy. The cgroup1 hierarchy is identified by its hierarchy ID.

This helper function is added to facilitate the tracing of tasks within
a particular container or cgroup dir in BPF programs. It's important to
note that this helper is designed specifically for cgroup1 only.

tj: Use irsqsave/restore as suggested by Hou Tao <houtao@huaweicloud.com>.

Suggested-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
Cc: Hou Tao <houtao@huaweicloud.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
include/linux/cgroup.h
kernel/cgroup/cgroup-internal.h
kernel/cgroup/cgroup-v1.c