|
57 | 57 | #include <linux/file.h> |
58 | 58 | #include <linux/fs_parser.h> |
59 | 59 | #include <linux/sched/cputime.h> |
| 60 | +#include <linux/sched/deadline.h> |
60 | 61 | #include <linux/psi.h> |
61 | 62 | #include <net/sock.h> |
62 | 63 |
|
@@ -312,8 +313,6 @@ bool cgroup_ssid_enabled(int ssid) |
312 | 313 | * masks of ancestors. |
313 | 314 | * |
314 | 315 | * - blkcg: blk-throttle becomes properly hierarchical. |
315 | | - * |
316 | | - * - debug: disallowed on the default hierarchy. |
317 | 316 | */ |
318 | 317 | bool cgroup_on_dfl(const struct cgroup *cgrp) |
319 | 318 | { |
@@ -356,7 +355,7 @@ static bool cgroup_has_tasks(struct cgroup *cgrp) |
356 | 355 | return cgrp->nr_populated_csets; |
357 | 356 | } |
358 | 357 |
|
359 | | -bool cgroup_is_threaded(struct cgroup *cgrp) |
| 358 | +static bool cgroup_is_threaded(struct cgroup *cgrp) |
360 | 359 | { |
361 | 360 | return cgrp->dom_cgrp != cgrp; |
362 | 361 | } |
@@ -395,7 +394,7 @@ static bool cgroup_can_be_thread_root(struct cgroup *cgrp) |
395 | 394 | } |
396 | 395 |
|
397 | 396 | /* is @cgrp root of a threaded subtree? */ |
398 | | -bool cgroup_is_thread_root(struct cgroup *cgrp) |
| 397 | +static bool cgroup_is_thread_root(struct cgroup *cgrp) |
399 | 398 | { |
400 | 399 | /* thread root should be a domain */ |
401 | 400 | if (cgroup_is_threaded(cgrp)) |
@@ -618,7 +617,7 @@ EXPORT_SYMBOL_GPL(cgroup_get_e_css); |
618 | 617 | static void cgroup_get_live(struct cgroup *cgrp) |
619 | 618 | { |
620 | 619 | WARN_ON_ONCE(cgroup_is_dead(cgrp)); |
621 | | - css_get(&cgrp->self); |
| 620 | + cgroup_get(cgrp); |
622 | 621 | } |
623 | 622 |
|
624 | 623 | /** |
@@ -689,21 +688,6 @@ EXPORT_SYMBOL_GPL(of_css); |
689 | 688 | lockdep_is_held(&cgroup_mutex)))) { } \ |
690 | 689 | else |
691 | 690 |
|
692 | | -/** |
693 | | - * for_each_e_css - iterate all effective css's of a cgroup |
694 | | - * @css: the iteration cursor |
695 | | - * @ssid: the index of the subsystem, CGROUP_SUBSYS_COUNT after reaching the end |
696 | | - * @cgrp: the target cgroup to iterate css's of |
697 | | - * |
698 | | - * Should be called under cgroup_[tree_]mutex. |
699 | | - */ |
700 | | -#define for_each_e_css(css, ssid, cgrp) \ |
701 | | - for ((ssid) = 0; (ssid) < CGROUP_SUBSYS_COUNT; (ssid)++) \ |
702 | | - if (!((css) = cgroup_e_css_by_mask(cgrp, \ |
703 | | - cgroup_subsys[(ssid)]))) \ |
704 | | - ; \ |
705 | | - else |
706 | | - |
707 | 691 | /** |
708 | 692 | * do_each_subsys_mask - filter for_each_subsys with a bitmask |
709 | 693 | * @ss: the iteration cursor |
@@ -2392,45 +2376,6 @@ int cgroup_path_ns(struct cgroup *cgrp, char *buf, size_t buflen, |
2392 | 2376 | } |
2393 | 2377 | EXPORT_SYMBOL_GPL(cgroup_path_ns); |
2394 | 2378 |
|
2395 | | -/** |
2396 | | - * task_cgroup_path - cgroup path of a task in the first cgroup hierarchy |
2397 | | - * @task: target task |
2398 | | - * @buf: the buffer to write the path into |
2399 | | - * @buflen: the length of the buffer |
2400 | | - * |
2401 | | - * Determine @task's cgroup on the first (the one with the lowest non-zero |
2402 | | - * hierarchy_id) cgroup hierarchy and copy its path into @buf. This |
2403 | | - * function grabs cgroup_mutex and shouldn't be used inside locks used by |
2404 | | - * cgroup controller callbacks. |
2405 | | - * |
2406 | | - * Return value is the same as kernfs_path(). |
2407 | | - */ |
2408 | | -int task_cgroup_path(struct task_struct *task, char *buf, size_t buflen) |
2409 | | -{ |
2410 | | - struct cgroup_root *root; |
2411 | | - struct cgroup *cgrp; |
2412 | | - int hierarchy_id = 1; |
2413 | | - int ret; |
2414 | | - |
2415 | | - cgroup_lock(); |
2416 | | - spin_lock_irq(&css_set_lock); |
2417 | | - |
2418 | | - root = idr_get_next(&cgroup_hierarchy_idr, &hierarchy_id); |
2419 | | - |
2420 | | - if (root) { |
2421 | | - cgrp = task_cgroup_from_root(task, root); |
2422 | | - ret = cgroup_path_ns_locked(cgrp, buf, buflen, &init_cgroup_ns); |
2423 | | - } else { |
2424 | | - /* if no hierarchy exists, everyone is in "/" */ |
2425 | | - ret = strscpy(buf, "/", buflen); |
2426 | | - } |
2427 | | - |
2428 | | - spin_unlock_irq(&css_set_lock); |
2429 | | - cgroup_unlock(); |
2430 | | - return ret; |
2431 | | -} |
2432 | | -EXPORT_SYMBOL_GPL(task_cgroup_path); |
2433 | | - |
2434 | 2379 | /** |
2435 | 2380 | * cgroup_attach_lock - Lock for ->attach() |
2436 | 2381 | * @lock_threadgroup: whether to down_write cgroup_threadgroup_rwsem |
@@ -2885,9 +2830,9 @@ int cgroup_migrate(struct task_struct *leader, bool threadgroup, |
2885 | 2830 | struct task_struct *task; |
2886 | 2831 |
|
2887 | 2832 | /* |
2888 | | - * Prevent freeing of tasks while we take a snapshot. Tasks that are |
2889 | | - * already PF_EXITING could be freed from underneath us unless we |
2890 | | - * take an rcu_read_lock. |
| 2833 | + * The following thread iteration should be inside an RCU critical |
| 2834 | + * section to prevent tasks from being freed while taking the snapshot. |
| 2835 | + * spin_lock_irq() implies RCU critical section here. |
2891 | 2836 | */ |
2892 | 2837 | spin_lock_irq(&css_set_lock); |
2893 | 2838 | task = leader; |
@@ -6708,6 +6653,9 @@ void cgroup_exit(struct task_struct *tsk) |
6708 | 6653 | list_add_tail(&tsk->cg_list, &cset->dying_tasks); |
6709 | 6654 | cset->nr_tasks--; |
6710 | 6655 |
|
| 6656 | + if (dl_task(tsk)) |
| 6657 | + dec_dl_tasks_cs(tsk); |
| 6658 | + |
6711 | 6659 | WARN_ON_ONCE(cgroup_task_frozen(tsk)); |
6712 | 6660 | if (unlikely(!(tsk->flags & PF_KTHREAD) && |
6713 | 6661 | test_bit(CGRP_FREEZE, &task_dfl_cgroup(tsk)->flags))) |
|
0 commit comments