[Devel] [PATCH rh7] Port diff-fairsched-optimize-sys_fairsched_mvpr

Vladimir Davydov vdavydov at parallels.com
Fri May 29 04:41:18 PDT 2015


Author: Konstantin Khlebnikov
Email: khlebnikov at openvz.org
Subject: fairsched: optimize sys_fairsched_mvpr()
Date: Wed, 08 May 2013 13:59:04 +0400

Remove task_list_lock and optimize for current.

https://jira.sw.ru/browse/PCLIN-26766

Signed-off-by: Konstantin Khlebnikov <khlebnikov at openvz.org>
=============================================================================

Related to https://jira.sw.ru/browse/PSBM-33642

Signed-off-by: Vladimir Davydov <vdavydov at parallels.com>
---
 kernel/fairsched.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/kernel/fairsched.c b/kernel/fairsched.c
index 3879f8e6b5c9..40d3eff7452e 100644
--- a/kernel/fairsched.c
+++ b/kernel/fairsched.c
@@ -243,16 +243,17 @@ SYSCALL_DEFINE2(fairsched_mvpr, pid_t, pid, unsigned int, id)
 	if (retval)
 		return retval;
 
-	write_lock_irq(&tasklist_lock);
-	tsk = find_task_by_vpid(pid);
+	rcu_read_lock();
+	tsk = current;
+	if (pid != task_pid_vnr(tsk))
+		tsk = find_task_by_vpid(pid);
 	if (tsk == NULL) {
-		write_unlock_irq(&tasklist_lock);
+		rcu_read_unlock();
 		retval = -ESRCH;
 		goto out;
 	}
 	get_task_struct(tsk);
-	write_unlock_irq(&tasklist_lock);
-
+	rcu_read_unlock();
 
 	retval = fairsched_move(&node, tsk);
 
-- 
2.1.4




More information about the Devel mailing list