diff options
Diffstat (limited to 'kernel/sched/psi.c')
-rw-r--r-- | kernel/sched/psi.c | 43 |
1 files changed, 22 insertions, 21 deletions
diff --git a/kernel/sched/psi.c b/kernel/sched/psi.c index 7cdecfc010af..3d7355d7c3e3 100644 --- a/kernel/sched/psi.c +++ b/kernel/sched/psi.c | |||
@@ -633,38 +633,39 @@ void psi_cgroup_free(struct cgroup *cgroup) | |||
633 | */ | 633 | */ |
634 | void cgroup_move_task(struct task_struct *task, struct css_set *to) | 634 | void cgroup_move_task(struct task_struct *task, struct css_set *to) |
635 | { | 635 | { |
636 | bool move_psi = !psi_disabled; | ||
637 | unsigned int task_flags = 0; | 636 | unsigned int task_flags = 0; |
638 | struct rq_flags rf; | 637 | struct rq_flags rf; |
639 | struct rq *rq; | 638 | struct rq *rq; |
640 | 639 | ||
641 | if (move_psi) { | 640 | if (psi_disabled) { |
642 | rq = task_rq_lock(task, &rf); | 641 | /* |
642 | * Lame to do this here, but the scheduler cannot be locked | ||
643 | * from the outside, so we move cgroups from inside sched/. | ||
644 | */ | ||
645 | rcu_assign_pointer(task->cgroups, to); | ||
646 | return; | ||
647 | } | ||
643 | 648 | ||
644 | if (task_on_rq_queued(task)) | 649 | rq = task_rq_lock(task, &rf); |
645 | task_flags = TSK_RUNNING; | ||
646 | else if (task->in_iowait) | ||
647 | task_flags = TSK_IOWAIT; | ||
648 | 650 | ||
649 | if (task->flags & PF_MEMSTALL) | 651 | if (task_on_rq_queued(task)) |
650 | task_flags |= TSK_MEMSTALL; | 652 | task_flags = TSK_RUNNING; |
653 | else if (task->in_iowait) | ||
654 | task_flags = TSK_IOWAIT; | ||
651 | 655 | ||
652 | if (task_flags) | 656 | if (task->flags & PF_MEMSTALL) |
653 | psi_task_change(task, task_flags, 0); | 657 | task_flags |= TSK_MEMSTALL; |
654 | } | ||
655 | 658 | ||
656 | /* | 659 | if (task_flags) |
657 | * Lame to do this here, but the scheduler cannot be locked | 660 | psi_task_change(task, task_flags, 0); |
658 | * from the outside, so we move cgroups from inside sched/. | 661 | |
659 | */ | 662 | /* See comment above */ |
660 | rcu_assign_pointer(task->cgroups, to); | 663 | rcu_assign_pointer(task->cgroups, to); |
661 | 664 | ||
662 | if (move_psi) { | 665 | if (task_flags) |
663 | if (task_flags) | 666 | psi_task_change(task, 0, task_flags); |
664 | psi_task_change(task, 0, task_flags); | ||
665 | 667 | ||
666 | task_rq_unlock(rq, task, &rf); | 668 | task_rq_unlock(rq, task, &rf); |
667 | } | ||
668 | } | 669 | } |
669 | #endif /* CONFIG_CGROUPS */ | 670 | #endif /* CONFIG_CGROUPS */ |
670 | 671 | ||