| .. | .. |
|---|
| 7 | 7 | #include <linux/workqueue.h> |
|---|
| 8 | 8 | #include <linux/list.h> |
|---|
| 9 | 9 | #include <linux/refcount.h> |
|---|
| 10 | +#include <linux/fs_parser.h> |
|---|
| 10 | 11 | |
|---|
| 11 | 12 | #define TRACE_CGROUP_PATH_LEN 1024 |
|---|
| 12 | 13 | extern spinlock_t trace_cgroup_path_lock; |
|---|
| 13 | 14 | extern char trace_cgroup_path[TRACE_CGROUP_PATH_LEN]; |
|---|
| 15 | +extern bool cgroup_debug; |
|---|
| 16 | +extern void __init enable_debug_cgroup(void); |
|---|
| 14 | 17 | |
|---|
| 15 | 18 | /* |
|---|
| 16 | 19 | * cgroup_path() takes a spin lock. It is good practice not to take |
|---|
| .. | .. |
|---|
| 25 | 28 | #define TRACE_CGROUP_PATH(type, cgrp, ...) \ |
|---|
| 26 | 29 | do { \ |
|---|
| 27 | 30 | if (trace_cgroup_##type##_enabled()) { \ |
|---|
| 28 | | - spin_lock(&trace_cgroup_path_lock); \ |
|---|
| 31 | + unsigned long flags; \ |
|---|
| 32 | + spin_lock_irqsave(&trace_cgroup_path_lock, \ |
|---|
| 33 | + flags); \ |
|---|
| 29 | 34 | cgroup_path(cgrp, trace_cgroup_path, \ |
|---|
| 30 | 35 | TRACE_CGROUP_PATH_LEN); \ |
|---|
| 31 | 36 | trace_cgroup_##type(cgrp, trace_cgroup_path, \ |
|---|
| 32 | 37 | ##__VA_ARGS__); \ |
|---|
| 33 | | - spin_unlock(&trace_cgroup_path_lock); \ |
|---|
| 38 | + spin_unlock_irqrestore(&trace_cgroup_path_lock, \ |
|---|
| 39 | + flags); \ |
|---|
| 34 | 40 | } \ |
|---|
| 35 | 41 | } while (0) |
|---|
| 42 | + |
|---|
| 43 | +/* |
|---|
| 44 | + * The cgroup filesystem superblock creation/mount context. |
|---|
| 45 | + */ |
|---|
| 46 | +struct cgroup_fs_context { |
|---|
| 47 | + struct kernfs_fs_context kfc; |
|---|
| 48 | + struct cgroup_root *root; |
|---|
| 49 | + struct cgroup_namespace *ns; |
|---|
| 50 | + unsigned int flags; /* CGRP_ROOT_* flags */ |
|---|
| 51 | + |
|---|
| 52 | + /* cgroup1 bits */ |
|---|
| 53 | + bool cpuset_clone_children; |
|---|
| 54 | + bool none; /* User explicitly requested empty subsystem */ |
|---|
| 55 | + bool all_ss; /* Seen 'all' option */ |
|---|
| 56 | + u16 subsys_mask; /* Selected subsystems */ |
|---|
| 57 | + char *name; /* Hierarchy name */ |
|---|
| 58 | + char *release_agent; /* Path for release notifications */ |
|---|
| 59 | +}; |
|---|
| 60 | + |
|---|
| 61 | +static inline struct cgroup_fs_context *cgroup_fc2context(struct fs_context *fc) |
|---|
| 62 | +{ |
|---|
| 63 | + struct kernfs_fs_context *kfc = fc->fs_private; |
|---|
| 64 | + |
|---|
| 65 | + return container_of(kfc, struct cgroup_fs_context, kfc); |
|---|
| 66 | +} |
|---|
| 67 | + |
|---|
| 68 | +struct cgroup_pidlist; |
|---|
| 69 | + |
|---|
| 70 | +struct cgroup_file_ctx { |
|---|
| 71 | + struct cgroup_namespace *ns; |
|---|
| 72 | + |
|---|
| 73 | + struct { |
|---|
| 74 | + void *trigger; |
|---|
| 75 | + } psi; |
|---|
| 76 | + |
|---|
| 77 | + struct { |
|---|
| 78 | + bool started; |
|---|
| 79 | + struct css_task_iter iter; |
|---|
| 80 | + } procs; |
|---|
| 81 | + |
|---|
| 82 | + struct { |
|---|
| 83 | + struct cgroup_pidlist *pidlist; |
|---|
| 84 | + } procs1; |
|---|
| 85 | +}; |
|---|
| 36 | 86 | |
|---|
| 37 | 87 | /* |
|---|
| 38 | 88 | * A cgroup can be associated with multiple css_sets as different tasks may |
|---|
| .. | .. |
|---|
| 115 | 165 | #define DEFINE_CGROUP_MGCTX(name) \ |
|---|
| 116 | 166 | struct cgroup_mgctx name = CGROUP_MGCTX_INIT(name) |
|---|
| 117 | 167 | |
|---|
| 118 | | -struct cgroup_sb_opts { |
|---|
| 119 | | - u16 subsys_mask; |
|---|
| 120 | | - unsigned int flags; |
|---|
| 121 | | - char *release_agent; |
|---|
| 122 | | - bool cpuset_clone_children; |
|---|
| 123 | | - char *name; |
|---|
| 124 | | - /* User explicitly requested empty subsystem */ |
|---|
| 125 | | - bool none; |
|---|
| 126 | | -}; |
|---|
| 127 | | - |
|---|
| 128 | 168 | extern struct mutex cgroup_mutex; |
|---|
| 129 | 169 | extern spinlock_t css_set_lock; |
|---|
| 130 | 170 | extern struct cgroup_subsys *cgroup_subsys[]; |
|---|
| 131 | 171 | extern struct list_head cgroup_roots; |
|---|
| 132 | | -extern struct file_system_type cgroup_fs_type; |
|---|
| 133 | 172 | |
|---|
| 134 | 173 | /* iterate across the hierarchies */ |
|---|
| 135 | 174 | #define for_each_root(root) \ |
|---|
| .. | .. |
|---|
| 195 | 234 | struct cgroup_namespace *ns); |
|---|
| 196 | 235 | |
|---|
| 197 | 236 | void cgroup_free_root(struct cgroup_root *root); |
|---|
| 198 | | -void init_cgroup_root(struct cgroup_root *root, struct cgroup_sb_opts *opts); |
|---|
| 237 | +void init_cgroup_root(struct cgroup_fs_context *ctx); |
|---|
| 199 | 238 | int cgroup_setup_root(struct cgroup_root *root, u16 ss_mask); |
|---|
| 200 | 239 | int rebind_subsystems(struct cgroup_root *dst_root, u16 ss_mask); |
|---|
| 201 | | -struct dentry *cgroup_do_mount(struct file_system_type *fs_type, int flags, |
|---|
| 202 | | - struct cgroup_root *root, unsigned long magic, |
|---|
| 203 | | - struct cgroup_namespace *ns); |
|---|
| 240 | +int cgroup_do_get_tree(struct fs_context *fc); |
|---|
| 204 | 241 | |
|---|
| 205 | 242 | int cgroup_migrate_vet_dst(struct cgroup *dst_cgrp); |
|---|
| 206 | 243 | void cgroup_migrate_finish(struct cgroup_mgctx *mgctx); |
|---|
| .. | .. |
|---|
| 212 | 249 | |
|---|
| 213 | 250 | int cgroup_attach_task(struct cgroup *dst_cgrp, struct task_struct *leader, |
|---|
| 214 | 251 | bool threadgroup); |
|---|
| 215 | | -struct task_struct *cgroup_procs_write_start(char *buf, bool threadgroup) |
|---|
| 252 | +struct task_struct *cgroup_procs_write_start(char *buf, bool threadgroup, |
|---|
| 253 | + bool *locked, |
|---|
| 254 | + struct cgroup *dst_cgrp); |
|---|
| 216 | 255 | __acquires(&cgroup_threadgroup_rwsem); |
|---|
| 217 | | -void cgroup_procs_write_finish(struct task_struct *task) |
|---|
| 256 | +void cgroup_procs_write_finish(struct task_struct *task, bool locked) |
|---|
| 218 | 257 | __releases(&cgroup_threadgroup_rwsem); |
|---|
| 219 | 258 | |
|---|
| 220 | 259 | void cgroup_lock_and_drain_offline(struct cgroup *cgrp); |
|---|
| .. | .. |
|---|
| 245 | 284 | */ |
|---|
| 246 | 285 | extern struct cftype cgroup1_base_files[]; |
|---|
| 247 | 286 | extern struct kernfs_syscall_ops cgroup1_kf_syscall_ops; |
|---|
| 287 | +extern const struct fs_parameter_spec cgroup1_fs_parameters[]; |
|---|
| 248 | 288 | |
|---|
| 249 | 289 | int proc_cgroupstats_show(struct seq_file *m, void *v); |
|---|
| 250 | 290 | bool cgroup1_ssid_disabled(int ssid); |
|---|
| 251 | 291 | void cgroup1_pidlist_destroy_all(struct cgroup *cgrp); |
|---|
| 252 | 292 | void cgroup1_release_agent(struct work_struct *work); |
|---|
| 253 | 293 | void cgroup1_check_for_release(struct cgroup *cgrp); |
|---|
| 254 | | -struct dentry *cgroup1_mount(struct file_system_type *fs_type, int flags, |
|---|
| 255 | | - void *data, unsigned long magic, |
|---|
| 256 | | - struct cgroup_namespace *ns); |
|---|
| 294 | +int cgroup1_parse_param(struct fs_context *fc, struct fs_parameter *param); |
|---|
| 295 | +int cgroup1_get_tree(struct fs_context *fc); |
|---|
| 296 | +int cgroup1_reconfigure(struct fs_context *ctx); |
|---|
| 257 | 297 | |
|---|
| 258 | 298 | #endif /* __CGROUP_INTERNAL_H */ |
|---|