[PATCH 3/3] sched/fair: Kill task_change_group_fair()
From: Kirill Tkhai
Date: Tue Feb 21 2017 - 07:11:24 EST
Since we need the special behaviour for TASK_MOVE_GROUP case only,
we may move the switch up to sched_change_group() and kill
task_change_group_fair().
I suppose, this may simplify the code in some way.
Signed-off-by: Kirill Tkhai <ktkhai@xxxxxxxxxxxxx>
---
kernel/sched/core.c | 4 ++--
kernel/sched/fair.c | 15 +--------------
kernel/sched/sched.h | 2 +-
3 files changed, 4 insertions(+), 17 deletions(-)
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 8f972df76eb2..5007892342b2 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -6395,8 +6395,8 @@ static void sched_change_group(struct task_struct *tsk, int type)
tsk->sched_task_group = tg;
#ifdef CONFIG_FAIR_GROUP_SCHED
- if (tsk->sched_class->task_change_group)
- tsk->sched_class->task_change_group(tsk, type);
+ if (tsk->sched_class->task_move_group && type == TASK_MOVE_GROUP)
+ tsk->sched_class->task_move_group(tsk);
else
#endif
set_task_rq(tsk, task_cpu(tsk));
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index a005bee12e0b..cf6d12513a3f 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -9206,19 +9206,6 @@ static void task_move_group_fair(struct task_struct *p)
attach_task_cfs_rq(p);
}
-static void task_change_group_fair(struct task_struct *p, int type)
-{
- switch (type) {
- case TASK_SET_GROUP:
- set_task_rq(p, task_cpu(p));
- break;
-
- case TASK_MOVE_GROUP:
- task_move_group_fair(p);
- break;
- }
-}
-
void free_fair_sched_group(struct task_group *tg)
{
int i;
@@ -9462,7 +9449,7 @@ const struct sched_class fair_sched_class = {
.update_curr = update_curr_fair,
#ifdef CONFIG_FAIR_GROUP_SCHED
- .task_change_group = task_change_group_fair,
+ .task_move_group = task_move_group_fair,
#endif
};
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index 4a9313f0b5c8..f2bc04826ea5 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -1407,7 +1407,7 @@ struct sched_class {
#define TASK_MOVE_GROUP 1
#ifdef CONFIG_FAIR_GROUP_SCHED
- void (*task_change_group) (struct task_struct *p, int type);
+ void (*task_move_group) (struct task_struct *p);
#endif
};