Commit ae8393e5 authored by Srivatsa Vaddagiri's avatar Srivatsa Vaddagiri Committed by Ingo Molnar

sched: move rcu_head to task_group struct

Peter Zijlstra noticed that the rcu_head object need not be present
in every cfs_rq of a group. Move it to the task_group structure
instead.
Signed-off-by: default avatarSrivatsa Vaddagiri <vatsa@linux.vnet.ibm.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 7bae49d4
...@@ -172,6 +172,7 @@ struct task_group { ...@@ -172,6 +172,7 @@ struct task_group {
unsigned long shares; unsigned long shares;
/* spinlock to serialize modification to shares */ /* spinlock to serialize modification to shares */
spinlock_t lock; spinlock_t lock;
struct rcu_head rcu;
}; };
/* Default task group's sched entity on each cpu */ /* Default task group's sched entity on each cpu */
...@@ -258,7 +259,6 @@ struct cfs_rq { ...@@ -258,7 +259,6 @@ struct cfs_rq {
*/ */
struct list_head leaf_cfs_rq_list; /* Better name : task_cfs_rq_list? */ struct list_head leaf_cfs_rq_list; /* Better name : task_cfs_rq_list? */
struct task_group *tg; /* group that "owns" this runqueue */ struct task_group *tg; /* group that "owns" this runqueue */
struct rcu_head rcu;
#endif #endif
}; };
...@@ -7019,8 +7019,8 @@ struct task_group *sched_create_group(void) ...@@ -7019,8 +7019,8 @@ struct task_group *sched_create_group(void)
/* rcu callback to free various structures associated with a task group */ /* rcu callback to free various structures associated with a task group */
static void free_sched_group(struct rcu_head *rhp) static void free_sched_group(struct rcu_head *rhp)
{ {
struct cfs_rq *cfs_rq = container_of(rhp, struct cfs_rq, rcu); struct task_group *tg = container_of(rhp, struct task_group, rcu);
struct task_group *tg = cfs_rq->tg; struct cfs_rq *cfs_rq;
struct sched_entity *se; struct sched_entity *se;
int i; int i;
...@@ -7052,7 +7052,7 @@ void sched_destroy_group(struct task_group *tg) ...@@ -7052,7 +7052,7 @@ void sched_destroy_group(struct task_group *tg)
BUG_ON(!cfs_rq); BUG_ON(!cfs_rq);
/* wait for possible concurrent references to cfs_rqs complete */ /* wait for possible concurrent references to cfs_rqs complete */
call_rcu(&cfs_rq->rcu, free_sched_group); call_rcu(&tg->rcu, free_sched_group);
} }
/* change task's runqueue when it moves between groups. /* change task's runqueue when it moves between groups.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment