[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <148767904663.5212.9972276733201696001.stgit@localhost.localdomain>
Date: Tue, 21 Feb 2017 15:10:51 +0300
From: Kirill Tkhai <ktkhai@...tuozzo.com>
To: <peterz@...radead.org>, <mingo@...hat.com>,
<linux-kernel@...r.kernel.org>, <ktkhai@...tuozzo.com>
Subject: [PATCH 3/3] sched/fair: Kill task_change_group_fair()
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@...tuozzo.com>
---
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
};
Powered by blists - more mailing lists