0001
0002 #ifndef _LINUX_CGROUP_H
0003 #define _LINUX_CGROUP_H
0004
0005
0006
0007
0008
0009
0010
0011
0012 #include <linux/sched.h>
0013 #include <linux/cpumask.h>
0014 #include <linux/nodemask.h>
0015 #include <linux/rculist.h>
0016 #include <linux/cgroupstats.h>
0017 #include <linux/fs.h>
0018 #include <linux/seq_file.h>
0019 #include <linux/kernfs.h>
0020 #include <linux/jump_label.h>
0021 #include <linux/types.h>
0022 #include <linux/ns_common.h>
0023 #include <linux/nsproxy.h>
0024 #include <linux/user_namespace.h>
0025 #include <linux/refcount.h>
0026 #include <linux/kernel_stat.h>
0027
0028 #include <linux/cgroup-defs.h>
0029
0030 struct kernel_clone_args;
0031
0032 #ifdef CONFIG_CGROUPS
0033
0034
0035
0036
0037
0038
0039 #define CGROUP_WEIGHT_MIN 1
0040 #define CGROUP_WEIGHT_DFL 100
0041 #define CGROUP_WEIGHT_MAX 10000
0042
0043
0044 #define CSS_TASK_ITER_PROCS (1U << 0)
0045
0046 #define CSS_TASK_ITER_THREADED (1U << 1)
0047
0048
0049 #define CSS_TASK_ITER_SKIPPED (1U << 16)
0050
0051
0052 struct css_task_iter {
0053 struct cgroup_subsys *ss;
0054 unsigned int flags;
0055
0056 struct list_head *cset_pos;
0057 struct list_head *cset_head;
0058
0059 struct list_head *tcset_pos;
0060 struct list_head *tcset_head;
0061
0062 struct list_head *task_pos;
0063
0064 struct list_head *cur_tasks_head;
0065 struct css_set *cur_cset;
0066 struct css_set *cur_dcset;
0067 struct task_struct *cur_task;
0068 struct list_head iters_node;
0069 };
0070
0071 extern struct cgroup_root cgrp_dfl_root;
0072 extern struct css_set init_css_set;
0073
0074 #define SUBSYS(_x) extern struct cgroup_subsys _x ## _cgrp_subsys;
0075 #include <linux/cgroup_subsys.h>
0076 #undef SUBSYS
0077
0078 #define SUBSYS(_x) \
0079 extern struct static_key_true _x ## _cgrp_subsys_enabled_key; \
0080 extern struct static_key_true _x ## _cgrp_subsys_on_dfl_key;
0081 #include <linux/cgroup_subsys.h>
0082 #undef SUBSYS
0083
0084
0085
0086
0087
0088 #define cgroup_subsys_enabled(ss) \
0089 static_branch_likely(&ss ## _enabled_key)
0090
0091
0092
0093
0094
0095 #define cgroup_subsys_on_dfl(ss) \
0096 static_branch_likely(&ss ## _on_dfl_key)
0097
0098 bool css_has_online_children(struct cgroup_subsys_state *css);
0099 struct cgroup_subsys_state *css_from_id(int id, struct cgroup_subsys *ss);
0100 struct cgroup_subsys_state *cgroup_e_css(struct cgroup *cgroup,
0101 struct cgroup_subsys *ss);
0102 struct cgroup_subsys_state *cgroup_get_e_css(struct cgroup *cgroup,
0103 struct cgroup_subsys *ss);
0104 struct cgroup_subsys_state *css_tryget_online_from_dir(struct dentry *dentry,
0105 struct cgroup_subsys *ss);
0106
0107 struct cgroup *cgroup_get_from_path(const char *path);
0108 struct cgroup *cgroup_get_from_fd(int fd);
0109
0110 int cgroup_attach_task_all(struct task_struct *from, struct task_struct *);
0111 int cgroup_transfer_tasks(struct cgroup *to, struct cgroup *from);
0112
0113 int cgroup_add_dfl_cftypes(struct cgroup_subsys *ss, struct cftype *cfts);
0114 int cgroup_add_legacy_cftypes(struct cgroup_subsys *ss, struct cftype *cfts);
0115 int cgroup_rm_cftypes(struct cftype *cfts);
0116 void cgroup_file_notify(struct cgroup_file *cfile);
0117
0118 int task_cgroup_path(struct task_struct *task, char *buf, size_t buflen);
0119 int cgroupstats_build(struct cgroupstats *stats, struct dentry *dentry);
0120 int proc_cgroup_show(struct seq_file *m, struct pid_namespace *ns,
0121 struct pid *pid, struct task_struct *tsk);
0122
0123 void cgroup_fork(struct task_struct *p);
0124 extern int cgroup_can_fork(struct task_struct *p,
0125 struct kernel_clone_args *kargs);
0126 extern void cgroup_cancel_fork(struct task_struct *p,
0127 struct kernel_clone_args *kargs);
0128 extern void cgroup_post_fork(struct task_struct *p,
0129 struct kernel_clone_args *kargs);
0130 void cgroup_exit(struct task_struct *p);
0131 void cgroup_release(struct task_struct *p);
0132 void cgroup_free(struct task_struct *p);
0133
0134 int cgroup_init_early(void);
0135 int cgroup_init(void);
0136
0137 int cgroup_parse_float(const char *input, unsigned dec_shift, s64 *v);
0138
0139
0140
0141
0142
0143 struct cgroup_subsys_state *css_next_child(struct cgroup_subsys_state *pos,
0144 struct cgroup_subsys_state *parent);
0145 struct cgroup_subsys_state *css_next_descendant_pre(struct cgroup_subsys_state *pos,
0146 struct cgroup_subsys_state *css);
0147 struct cgroup_subsys_state *css_rightmost_descendant(struct cgroup_subsys_state *pos);
0148 struct cgroup_subsys_state *css_next_descendant_post(struct cgroup_subsys_state *pos,
0149 struct cgroup_subsys_state *css);
0150
0151 struct task_struct *cgroup_taskset_first(struct cgroup_taskset *tset,
0152 struct cgroup_subsys_state **dst_cssp);
0153 struct task_struct *cgroup_taskset_next(struct cgroup_taskset *tset,
0154 struct cgroup_subsys_state **dst_cssp);
0155
0156 void css_task_iter_start(struct cgroup_subsys_state *css, unsigned int flags,
0157 struct css_task_iter *it);
0158 struct task_struct *css_task_iter_next(struct css_task_iter *it);
0159 void css_task_iter_end(struct css_task_iter *it);
0160
0161
0162
0163
0164
0165
0166
0167
0168
0169
0170
0171
0172
0173
0174
0175
0176
0177
0178
0179 #define css_for_each_child(pos, parent) \
0180 for ((pos) = css_next_child(NULL, (parent)); (pos); \
0181 (pos) = css_next_child((pos), (parent)))
0182
0183
0184
0185
0186
0187
0188
0189
0190
0191
0192
0193
0194
0195
0196
0197
0198
0199
0200
0201
0202
0203
0204
0205
0206
0207
0208
0209
0210
0211
0212
0213
0214
0215
0216
0217
0218
0219
0220
0221
0222
0223
0224
0225
0226
0227
0228
0229
0230
0231
0232
0233
0234
0235
0236
0237
0238
0239 #define css_for_each_descendant_pre(pos, css) \
0240 for ((pos) = css_next_descendant_pre(NULL, (css)); (pos); \
0241 (pos) = css_next_descendant_pre((pos), (css)))
0242
0243
0244
0245
0246
0247
0248
0249
0250
0251
0252
0253
0254
0255
0256
0257
0258
0259
0260
0261
0262 #define css_for_each_descendant_post(pos, css) \
0263 for ((pos) = css_next_descendant_post(NULL, (css)); (pos); \
0264 (pos) = css_next_descendant_post((pos), (css)))
0265
0266
0267
0268
0269
0270
0271
0272
0273
0274
0275
0276
0277
0278
0279
0280
0281
0282
0283
0284 #define cgroup_taskset_for_each(task, dst_css, tset) \
0285 for ((task) = cgroup_taskset_first((tset), &(dst_css)); \
0286 (task); \
0287 (task) = cgroup_taskset_next((tset), &(dst_css)))
0288
0289
0290
0291
0292
0293
0294
0295
0296
0297
0298 #define cgroup_taskset_for_each_leader(leader, dst_css, tset) \
0299 for ((leader) = cgroup_taskset_first((tset), &(dst_css)); \
0300 (leader); \
0301 (leader) = cgroup_taskset_next((tset), &(dst_css))) \
0302 if ((leader) != (leader)->group_leader) \
0303 ; \
0304 else
0305
0306
0307
0308
0309
0310 static inline u64 cgroup_id(const struct cgroup *cgrp)
0311 {
0312 return cgrp->kn->id;
0313 }
0314
0315
0316
0317
0318
0319
0320
0321 static inline void css_get(struct cgroup_subsys_state *css)
0322 {
0323 if (!(css->flags & CSS_NO_REF))
0324 percpu_ref_get(&css->refcnt);
0325 }
0326
0327
0328
0329
0330
0331
0332
0333
0334 static inline void css_get_many(struct cgroup_subsys_state *css, unsigned int n)
0335 {
0336 if (!(css->flags & CSS_NO_REF))
0337 percpu_ref_get_many(&css->refcnt, n);
0338 }
0339
0340
0341
0342
0343
0344
0345
0346
0347
0348
0349
0350
0351 static inline bool css_tryget(struct cgroup_subsys_state *css)
0352 {
0353 if (!(css->flags & CSS_NO_REF))
0354 return percpu_ref_tryget(&css->refcnt);
0355 return true;
0356 }
0357
0358
0359
0360
0361
0362
0363
0364
0365
0366
0367
0368 static inline bool css_tryget_online(struct cgroup_subsys_state *css)
0369 {
0370 if (!(css->flags & CSS_NO_REF))
0371 return percpu_ref_tryget_live(&css->refcnt);
0372 return true;
0373 }
0374
0375
0376
0377
0378
0379
0380
0381
0382
0383
0384
0385
0386
0387
0388
0389
0390 static inline bool css_is_dying(struct cgroup_subsys_state *css)
0391 {
0392 return !(css->flags & CSS_NO_REF) && percpu_ref_is_dying(&css->refcnt);
0393 }
0394
0395
0396
0397
0398
0399
0400
0401 static inline void css_put(struct cgroup_subsys_state *css)
0402 {
0403 if (!(css->flags & CSS_NO_REF))
0404 percpu_ref_put(&css->refcnt);
0405 }
0406
0407
0408
0409
0410
0411
0412
0413
0414 static inline void css_put_many(struct cgroup_subsys_state *css, unsigned int n)
0415 {
0416 if (!(css->flags & CSS_NO_REF))
0417 percpu_ref_put_many(&css->refcnt, n);
0418 }
0419
0420 static inline void cgroup_get(struct cgroup *cgrp)
0421 {
0422 css_get(&cgrp->self);
0423 }
0424
0425 static inline bool cgroup_tryget(struct cgroup *cgrp)
0426 {
0427 return css_tryget(&cgrp->self);
0428 }
0429
0430 static inline void cgroup_put(struct cgroup *cgrp)
0431 {
0432 css_put(&cgrp->self);
0433 }
0434
0435
0436
0437
0438
0439
0440
0441
0442
0443
0444
0445
0446
0447
0448 #ifdef CONFIG_PROVE_RCU
0449 extern struct mutex cgroup_mutex;
0450 extern spinlock_t css_set_lock;
0451 #define task_css_set_check(task, __c) \
0452 rcu_dereference_check((task)->cgroups, \
0453 rcu_read_lock_sched_held() || \
0454 lockdep_is_held(&cgroup_mutex) || \
0455 lockdep_is_held(&css_set_lock) || \
0456 ((task)->flags & PF_EXITING) || (__c))
0457 #else
0458 #define task_css_set_check(task, __c) \
0459 rcu_dereference((task)->cgroups)
0460 #endif
0461
0462
0463
0464
0465
0466
0467
0468
0469
0470
0471 #define task_css_check(task, subsys_id, __c) \
0472 task_css_set_check((task), (__c))->subsys[(subsys_id)]
0473
0474
0475
0476
0477
0478
0479
0480 static inline struct css_set *task_css_set(struct task_struct *task)
0481 {
0482 return task_css_set_check(task, false);
0483 }
0484
0485
0486
0487
0488
0489
0490
0491
0492 static inline struct cgroup_subsys_state *task_css(struct task_struct *task,
0493 int subsys_id)
0494 {
0495 return task_css_check(task, subsys_id, false);
0496 }
0497
0498
0499
0500
0501
0502
0503
0504
0505
0506
0507 static inline struct cgroup_subsys_state *
0508 task_get_css(struct task_struct *task, int subsys_id)
0509 {
0510 struct cgroup_subsys_state *css;
0511
0512 rcu_read_lock();
0513 while (true) {
0514 css = task_css(task, subsys_id);
0515
0516
0517
0518
0519
0520
0521 if (likely(css_tryget(css)))
0522 break;
0523 cpu_relax();
0524 }
0525 rcu_read_unlock();
0526 return css;
0527 }
0528
0529
0530
0531
0532
0533
0534
0535
0536
0537 static inline bool task_css_is_root(struct task_struct *task, int subsys_id)
0538 {
0539 return task_css_check(task, subsys_id, true) ==
0540 init_css_set.subsys[subsys_id];
0541 }
0542
0543 static inline struct cgroup *task_cgroup(struct task_struct *task,
0544 int subsys_id)
0545 {
0546 return task_css(task, subsys_id)->cgroup;
0547 }
0548
0549 static inline struct cgroup *task_dfl_cgroup(struct task_struct *task)
0550 {
0551 return task_css_set(task)->dfl_cgrp;
0552 }
0553
0554 static inline struct cgroup *cgroup_parent(struct cgroup *cgrp)
0555 {
0556 struct cgroup_subsys_state *parent_css = cgrp->self.parent;
0557
0558 if (parent_css)
0559 return container_of(parent_css, struct cgroup, self);
0560 return NULL;
0561 }
0562
0563
0564
0565
0566
0567
0568
0569
0570
0571
0572 static inline bool cgroup_is_descendant(struct cgroup *cgrp,
0573 struct cgroup *ancestor)
0574 {
0575 if (cgrp->root != ancestor->root || cgrp->level < ancestor->level)
0576 return false;
0577 return cgrp->ancestor_ids[ancestor->level] == cgroup_id(ancestor);
0578 }
0579
0580
0581
0582
0583
0584
0585
0586
0587
0588
0589
0590
0591 static inline struct cgroup *cgroup_ancestor(struct cgroup *cgrp,
0592 int ancestor_level)
0593 {
0594 if (cgrp->level < ancestor_level)
0595 return NULL;
0596 while (cgrp && cgrp->level > ancestor_level)
0597 cgrp = cgroup_parent(cgrp);
0598 return cgrp;
0599 }
0600
0601
0602
0603
0604
0605
0606
0607
0608
0609
0610 static inline bool task_under_cgroup_hierarchy(struct task_struct *task,
0611 struct cgroup *ancestor)
0612 {
0613 struct css_set *cset = task_css_set(task);
0614
0615 return cgroup_is_descendant(cset->dfl_cgrp, ancestor);
0616 }
0617
0618
0619 static inline bool cgroup_is_populated(struct cgroup *cgrp)
0620 {
0621 return cgrp->nr_populated_csets + cgrp->nr_populated_domain_children +
0622 cgrp->nr_populated_threaded_children;
0623 }
0624
0625
0626 static inline ino_t cgroup_ino(struct cgroup *cgrp)
0627 {
0628 return kernfs_ino(cgrp->kn);
0629 }
0630
0631
0632 static inline struct cftype *of_cft(struct kernfs_open_file *of)
0633 {
0634 return of->kn->priv;
0635 }
0636
0637 struct cgroup_subsys_state *of_css(struct kernfs_open_file *of);
0638
0639
0640 static inline struct cftype *seq_cft(struct seq_file *seq)
0641 {
0642 return of_cft(seq->private);
0643 }
0644
0645 static inline struct cgroup_subsys_state *seq_css(struct seq_file *seq)
0646 {
0647 return of_css(seq->private);
0648 }
0649
0650
0651
0652
0653
0654
0655 static inline int cgroup_name(struct cgroup *cgrp, char *buf, size_t buflen)
0656 {
0657 return kernfs_name(cgrp->kn, buf, buflen);
0658 }
0659
0660 static inline int cgroup_path(struct cgroup *cgrp, char *buf, size_t buflen)
0661 {
0662 return kernfs_path(cgrp->kn, buf, buflen);
0663 }
0664
0665 static inline void pr_cont_cgroup_name(struct cgroup *cgrp)
0666 {
0667 pr_cont_kernfs_name(cgrp->kn);
0668 }
0669
0670 static inline void pr_cont_cgroup_path(struct cgroup *cgrp)
0671 {
0672 pr_cont_kernfs_path(cgrp->kn);
0673 }
0674
0675 static inline struct psi_group *cgroup_psi(struct cgroup *cgrp)
0676 {
0677 return cgrp->psi;
0678 }
0679
0680 bool cgroup_psi_enabled(void);
0681
0682 static inline void cgroup_init_kthreadd(void)
0683 {
0684
0685
0686
0687
0688
0689 current->no_cgroup_migration = 1;
0690 }
0691
0692 static inline void cgroup_kthread_ready(void)
0693 {
0694
0695
0696
0697
0698 current->no_cgroup_migration = 0;
0699 }
0700
0701 void cgroup_path_from_kernfs_id(u64 id, char *buf, size_t buflen);
0702 struct cgroup *cgroup_get_from_id(u64 id);
0703 #else
0704
0705 struct cgroup_subsys_state;
0706 struct cgroup;
0707
0708 static inline u64 cgroup_id(const struct cgroup *cgrp) { return 1; }
0709 static inline void css_get(struct cgroup_subsys_state *css) {}
0710 static inline void css_put(struct cgroup_subsys_state *css) {}
0711 static inline int cgroup_attach_task_all(struct task_struct *from,
0712 struct task_struct *t) { return 0; }
0713 static inline int cgroupstats_build(struct cgroupstats *stats,
0714 struct dentry *dentry) { return -EINVAL; }
0715
0716 static inline void cgroup_fork(struct task_struct *p) {}
0717 static inline int cgroup_can_fork(struct task_struct *p,
0718 struct kernel_clone_args *kargs) { return 0; }
0719 static inline void cgroup_cancel_fork(struct task_struct *p,
0720 struct kernel_clone_args *kargs) {}
0721 static inline void cgroup_post_fork(struct task_struct *p,
0722 struct kernel_clone_args *kargs) {}
0723 static inline void cgroup_exit(struct task_struct *p) {}
0724 static inline void cgroup_release(struct task_struct *p) {}
0725 static inline void cgroup_free(struct task_struct *p) {}
0726
0727 static inline int cgroup_init_early(void) { return 0; }
0728 static inline int cgroup_init(void) { return 0; }
0729 static inline void cgroup_init_kthreadd(void) {}
0730 static inline void cgroup_kthread_ready(void) {}
0731
0732 static inline struct cgroup *cgroup_parent(struct cgroup *cgrp)
0733 {
0734 return NULL;
0735 }
0736
0737 static inline bool cgroup_psi_enabled(void)
0738 {
0739 return false;
0740 }
0741
0742 static inline bool task_under_cgroup_hierarchy(struct task_struct *task,
0743 struct cgroup *ancestor)
0744 {
0745 return true;
0746 }
0747
0748 static inline void cgroup_path_from_kernfs_id(u64 id, char *buf, size_t buflen)
0749 {}
0750
0751 static inline struct cgroup *cgroup_get_from_id(u64 id)
0752 {
0753 return NULL;
0754 }
0755 #endif
0756
0757 #ifdef CONFIG_CGROUPS
0758
0759
0760
0761 void cgroup_rstat_updated(struct cgroup *cgrp, int cpu);
0762 void cgroup_rstat_flush(struct cgroup *cgrp);
0763 void cgroup_rstat_flush_irqsafe(struct cgroup *cgrp);
0764 void cgroup_rstat_flush_hold(struct cgroup *cgrp);
0765 void cgroup_rstat_flush_release(void);
0766
0767
0768
0769
0770 #ifdef CONFIG_CGROUP_CPUACCT
0771 void cpuacct_charge(struct task_struct *tsk, u64 cputime);
0772 void cpuacct_account_field(struct task_struct *tsk, int index, u64 val);
0773 #else
0774 static inline void cpuacct_charge(struct task_struct *tsk, u64 cputime) {}
0775 static inline void cpuacct_account_field(struct task_struct *tsk, int index,
0776 u64 val) {}
0777 #endif
0778
0779 void __cgroup_account_cputime(struct cgroup *cgrp, u64 delta_exec);
0780 void __cgroup_account_cputime_field(struct cgroup *cgrp,
0781 enum cpu_usage_stat index, u64 delta_exec);
0782
0783 static inline void cgroup_account_cputime(struct task_struct *task,
0784 u64 delta_exec)
0785 {
0786 struct cgroup *cgrp;
0787
0788 cpuacct_charge(task, delta_exec);
0789
0790 cgrp = task_dfl_cgroup(task);
0791 if (cgroup_parent(cgrp))
0792 __cgroup_account_cputime(cgrp, delta_exec);
0793 }
0794
0795 static inline void cgroup_account_cputime_field(struct task_struct *task,
0796 enum cpu_usage_stat index,
0797 u64 delta_exec)
0798 {
0799 struct cgroup *cgrp;
0800
0801 cpuacct_account_field(task, index, delta_exec);
0802
0803 cgrp = task_dfl_cgroup(task);
0804 if (cgroup_parent(cgrp))
0805 __cgroup_account_cputime_field(cgrp, index, delta_exec);
0806 }
0807
0808 #else
0809
0810 static inline void cgroup_account_cputime(struct task_struct *task,
0811 u64 delta_exec) {}
0812 static inline void cgroup_account_cputime_field(struct task_struct *task,
0813 enum cpu_usage_stat index,
0814 u64 delta_exec) {}
0815
0816 #endif
0817
0818
0819
0820
0821
0822 #ifdef CONFIG_SOCK_CGROUP_DATA
0823
0824 void cgroup_sk_alloc(struct sock_cgroup_data *skcd);
0825 void cgroup_sk_clone(struct sock_cgroup_data *skcd);
0826 void cgroup_sk_free(struct sock_cgroup_data *skcd);
0827
0828 static inline struct cgroup *sock_cgroup_ptr(struct sock_cgroup_data *skcd)
0829 {
0830 return skcd->cgroup;
0831 }
0832
0833 #else
0834
0835 static inline void cgroup_sk_alloc(struct sock_cgroup_data *skcd) {}
0836 static inline void cgroup_sk_clone(struct sock_cgroup_data *skcd) {}
0837 static inline void cgroup_sk_free(struct sock_cgroup_data *skcd) {}
0838
0839 #endif
0840
0841 struct cgroup_namespace {
0842 struct ns_common ns;
0843 struct user_namespace *user_ns;
0844 struct ucounts *ucounts;
0845 struct css_set *root_cset;
0846 };
0847
0848 extern struct cgroup_namespace init_cgroup_ns;
0849
0850 #ifdef CONFIG_CGROUPS
0851
0852 void free_cgroup_ns(struct cgroup_namespace *ns);
0853
0854 struct cgroup_namespace *copy_cgroup_ns(unsigned long flags,
0855 struct user_namespace *user_ns,
0856 struct cgroup_namespace *old_ns);
0857
0858 int cgroup_path_ns(struct cgroup *cgrp, char *buf, size_t buflen,
0859 struct cgroup_namespace *ns);
0860
0861 #else
0862
0863 static inline void free_cgroup_ns(struct cgroup_namespace *ns) { }
0864 static inline struct cgroup_namespace *
0865 copy_cgroup_ns(unsigned long flags, struct user_namespace *user_ns,
0866 struct cgroup_namespace *old_ns)
0867 {
0868 return old_ns;
0869 }
0870
0871 #endif
0872
0873 static inline void get_cgroup_ns(struct cgroup_namespace *ns)
0874 {
0875 if (ns)
0876 refcount_inc(&ns->ns.count);
0877 }
0878
0879 static inline void put_cgroup_ns(struct cgroup_namespace *ns)
0880 {
0881 if (ns && refcount_dec_and_test(&ns->ns.count))
0882 free_cgroup_ns(ns);
0883 }
0884
0885 #ifdef CONFIG_CGROUPS
0886
0887 void cgroup_enter_frozen(void);
0888 void cgroup_leave_frozen(bool always_leave);
0889 void cgroup_update_frozen(struct cgroup *cgrp);
0890 void cgroup_freeze(struct cgroup *cgrp, bool freeze);
0891 void cgroup_freezer_migrate_task(struct task_struct *task, struct cgroup *src,
0892 struct cgroup *dst);
0893
0894 static inline bool cgroup_task_frozen(struct task_struct *task)
0895 {
0896 return task->frozen;
0897 }
0898
0899 #else
0900
0901 static inline void cgroup_enter_frozen(void) { }
0902 static inline void cgroup_leave_frozen(bool always_leave) { }
0903 static inline bool cgroup_task_frozen(struct task_struct *task)
0904 {
0905 return false;
0906 }
0907
0908 #endif
0909
0910 #ifdef CONFIG_CGROUP_BPF
0911 static inline void cgroup_bpf_get(struct cgroup *cgrp)
0912 {
0913 percpu_ref_get(&cgrp->bpf.refcnt);
0914 }
0915
0916 static inline void cgroup_bpf_put(struct cgroup *cgrp)
0917 {
0918 percpu_ref_put(&cgrp->bpf.refcnt);
0919 }
0920
0921 #else
0922
0923 static inline void cgroup_bpf_get(struct cgroup *cgrp) {}
0924 static inline void cgroup_bpf_put(struct cgroup *cgrp) {}
0925
0926 #endif
0927
0928 #endif