OpenVZ Forum


Home » Mailing lists » Devel » [RFC | PATCH 0/9] CPU controller over process container
[PATCH 5/9] deal with movement of tasks across groups [message #18209 is a reply to message #18204] Thu, 12 April 2007 17:57 Go to previous messageGo to previous message
Srivatsa Vaddagiri is currently offline  Srivatsa Vaddagiri
Messages: 241
Registered: August 2006
Senior Member
When a task moves between groups (as initiated by an administrator), it has to
be removed from the runqueue of its old group and added to the runqueue of its
new group. This patch defines this move operation.

Signed-off-by : Srivatsa Vaddagiri <vatsa@in.ibm.com>


 1 file changed, 28 insertions(+)


---


diff -puN kernel/sched.c~task_move kernel/sched.c
--- linux-2.6.20/kernel/sched.c~task_move	2007-04-11 12:00:51.000000000 +0530
+++ linux-2.6.20-vatsa/kernel/sched.c	2007-04-12 11:07:16.000000000 +0530
@@ -7449,4 +7449,32 @@ static int sched_get_quota(struct task_g
 	return cpu_quota(tg);
 }
 
+/*
+ * Move a task from one group to another. If the task is already on a
+ * runqueue, this involves removing the task from its old group's runqueue
+ * and adding to its new group's runqueue.
+ */
+static void sched_move_task(struct task_grp *tg_new, struct task_grp *tg_old,
+					struct task_struct *tsk)
+{
+	struct rq *rq;
+	unsigned long flags;
+
+	if (tg_new == tg_old)
+		return;
+
+	rq = task_rq_lock(tsk, &flags);
+
+	if (tsk->array) {
+		/* Set tsk->group to tg_old here */
+		deactivate_task(tsk, rq);
+		/* Set tsk->group to tg_new here */
+		__activate_task(tsk, rq);
+	}
+
+	task_rq_unlock(rq, &flags);
+
+	return;
+}
+
 #endif /* CONFIG_CPUMETER */
_
-- 
Regards,
vatsa
_______________________________________________
Containers mailing list
Containers@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: [RFC][PATCH] rename 'struct pid'
Next Topic: Re: [RFC | PATCH 0/9] CPU controller over process container
Goto Forum:
  


Current Time: Fri Aug 16 07:29:45 GMT 2024

Total time taken to generate the page: 0.02929 seconds