]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
cgroup: Allocate cgroup_file_ctx for kernfs_open_file->priv
authorTejun Heo <tj@kernel.org>
Thu, 6 Jan 2022 21:02:29 +0000 (11:02 -1000)
committerAndrea Righi <andrea.righi@canonical.com>
Fri, 21 Jan 2022 14:49:25 +0000 (15:49 +0100)
commit05647e34b1265bc734948a7c688e7e10addc6673
treed56a3cbfcdab814ac1629737b2e48670fc8cc833
parentc07a71adf3e0932e7d2e719f98cacb2b29bd0d5d
cgroup: Allocate cgroup_file_ctx for kernfs_open_file->priv

BugLink: https://bugs.launchpad.net/bugs/1957882
commit 0d2b5955b36250a9428c832664f2079cbf723bec upstream.

of->priv is currently used by each interface file implementation to store
private information. This patch collects the current two private data usages
into struct cgroup_file_ctx which is allocated and freed by the common path.
This allows generic private data which applies to multiple files, which will
be used to in the following patch.

Note that cgroup_procs iterator is now embedded as procs.iter in the new
cgroup_file_ctx so that it doesn't need to be allocated and freed
separately.

v2: union dropped from cgroup_file_ctx and the procs iterator is embedded in
    cgroup_file_ctx as suggested by Linus.

v3: Michal pointed out that cgroup1's procs pidlist uses of->priv too.
    Converted. Didn't change to embedded allocation as cgroup1 pidlists get
    stored for caching.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Reviewed-by: Michal Koutný <mkoutny@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paolo Pisati <p.pisati@gmail.com>
kernel/cgroup/cgroup-internal.h
kernel/cgroup/cgroup-v1.c
kernel/cgroup/cgroup.c