Skip to contentSkip to conversation

k_getrusage: don't take rcu_read_lock()

PATCH New Oleg Nesterov 1 participant 1 message Feb 18, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 2/2 k_getrusage: don't take rcu_read_lock()

(just a trivial example, more to come)

k_getrusage() holds rcu_read_lock() because it was previously required by lock_task_sighand(). Unneeded now.

kernel/sys.c renamed from kernel/sys.c~2_GRU +1 -6
@@ -1548,11 +1548,8 @@ static void k_getrusage(struct task_stru
 	memset((char *) r, 0, sizeof *r);
 	utime = stime = cputime_zero;
 
-	rcu_read_lock();
-	if (!lock_task_sighand(p, &flags)) {
-		rcu_read_unlock();
+	if (!lock_task_sighand(p, &flags))
 		return;
-	}
 
 	switch (who) {
 		case RUSAGE_BOTH:
@@ -1595,9 +1592,7 @@ static void k_getrusage(struct task_stru
 		default:
 			BUG();
 	}
-
 	unlock_task_sighand(p, &flags);
-	rcu_read_unlock();
 
 	cputime_to_timeval(utime, &r->ru_utime);
 	cputime_to_timeval(stime, &r->ru_stime);