Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1685967

[PATCH V5 07/11] cgroup: export fhandle info for a cgroup

From Shaohua Li <shli@kernel.org>
Newsgroups linux.kernel
Subject [PATCH V5 07/11] cgroup: export fhandle info for a cgroup
Date 2017-07-12 21:00 +0200
Message-ID <u2v1E-3rs-5@gated-at.bofh.it> (permalink)
References <u2v1D-3rs-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Shaohua Li <shli@fb.com>

Add an API to export cgroup fhandle info. We don't export a full 'struct
file_handle', there are unrequired info. Sepcifically, cgroup is always
a directory, so we don't need a 'FILEID_INO32_GEN_PARENT' type fhandle,
we only need export the inode number and generation number just like
what generic_fh_to_dentry does. And we can avoid the overhead of getting
an inode too, since kernfs_node_id (ino and generation) has all the info
required.

Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Shaohua Li <shli@fb.com>
---
 include/linux/cgroup.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index 30c6877..52ef9a6 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -609,6 +609,10 @@ static inline void cgroup_kthread_ready(void)
 	current->no_cgroup_migration = 0;
 }
 
+static inline union kernfs_node_id *cgroup_get_kernfs_id(struct cgroup *cgrp)
+{
+	return &cgrp->kn->id;
+}
 #else /* !CONFIG_CGROUPS */
 
 struct cgroup_subsys_state;
@@ -631,6 +635,10 @@ static inline int cgroup_init_early(void) { return 0; }
 static inline int cgroup_init(void) { return 0; }
 static inline void cgroup_init_kthreadd(void) {}
 static inline void cgroup_kthread_ready(void) {}
+static inline union kernfs_node_id *cgroup_get_kernfs_id(struct cgroup *cgrp)
+{
+	return NULL;
+}
 
 static inline bool task_under_cgroup_hierarchy(struct task_struct *task,
 					       struct cgroup *ancestor)
-- 
2.9.3

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH V5 00/11] blktrace: output cgroup info Shaohua Li <shli@kernel.org> - 2017-07-12 21:00 +0200
  [PATCH V5 11/11] block: use standard blktrace API to output cgroup info for debug notes Shaohua Li <shli@kernel.org> - 2017-07-12 21:00 +0200
  [PATCH V5 07/11] cgroup: export fhandle info for a cgroup Shaohua Li <shli@kernel.org> - 2017-07-12 21:00 +0200
  [PATCH V5 10/11] blktrace: add an option to allow displaying cgroup path Shaohua Li <shli@kernel.org> - 2017-07-12 21:00 +0200
  [PATCH V5 08/11] blktrace: export cgroup info in trace Shaohua Li <shli@kernel.org> - 2017-07-12 21:00 +0200
  [PATCH V5 02/11] kernfs: implement i_generation Shaohua Li <shli@kernel.org> - 2017-07-12 21:00 +0200
  [PATCH V5 06/11] kernfs: add exportfs operations Shaohua Li <shli@kernel.org> - 2017-07-12 21:00 +0200
  [PATCH V5 09/11] block: always attach cgroup info into bio Shaohua Li <shli@kernel.org> - 2017-07-12 21:00 +0200
  [PATCH V5 05/11] kernfs: introduce kernfs_node_id Shaohua Li <shli@kernel.org> - 2017-07-12 21:00 +0200
  [PATCH V5 04/11] kernfs: don't set dentry->d_fsdata Shaohua Li <shli@kernel.org> - 2017-07-12 21:00 +0200
  [PATCH V5 03/11] kernfs: add an API to get kernfs node from inode number Shaohua Li <shli@kernel.org> - 2017-07-12 21:00 +0200
  [PATCH V5 01/11] kernfs: use idr instead of ida to manage inode number Shaohua Li <shli@kernel.org> - 2017-07-12 21:00 +0200
  Re: [PATCH V5 00/11] blktrace: output cgroup info Jens Axboe <axboe@kernel.dk> - 2017-07-13 01:00 +0200

csiph-web