[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.

Signed-off-by: Oleg Nesterov <oleg@xxxxxxxxxx>

--- 25/kernel/sys.c~2_GRU 2008-02-15 16:59:17.000000000 +0300
+++ 25/kernel/sys.c 2008-02-18 19:15:40.000000000 +0300
@@ -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);

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



Relevant Pages

  • Re: [PATCH 3/4] security/selinux: decrement sizeof size in strncmp
    ... "sizeof" variant. ... strcmp, would be functionally correct but offers no value, ... More majordomo info at http://vger.kernel.org/majordomo-info.html ... Please read the FAQ at http://www.tux.org/lkml/ ...
    (Linux-Kernel)
  • Re: [PATCH] ide-cd: fix endianity for the error message in cdrom_read_capacity
    ... Bart owns this patch now. ... switch { ... More majordomo info at http://vger.kernel.org/majordomo-info.html ... Please read the FAQ at http://www.tux.org/lkml/ ...
    (Linux-Kernel)
  • Re: [PATCH 1/4] Calgary: phb_shift can be int
    ... switch ) { ... If you carefully review code and see that there is absolutely no possibility of using an uninitialized variable in any execution path, then you can assign it to itself to quiet the compiler. ... More majordomo info at http://vger.kernel.org/majordomo-info.html ... Please read the FAQ at http://www.tux.org/lkml/ ...
    (Linux-Kernel)
  • Re: [Bug #10724] ACPI: EC: GPE storm detected, disabling EC GPE
    ... that sometimes gnome-power-manager is slow to respond when I switch to ... The following bug entry is on the current list of known regressions ... More majordomo info at http://vger.kernel.org/majordomo-info.html ... Please read the FAQ at http://www.tux.org/lkml/ ...
    (Linux-Kernel)
  • Re: Tracing of power:power_start events doesnt work
    ... switch { ... included in the syntactic block of that case. ... More majordomo info at http://vger.kernel.org/majordomo-info.html ... Please read the FAQ at http://www.tux.org/lkml/ ...
    (Linux-Kernel)