lkml.org 
[lkml]   [2005]   [Dec]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [rfc][patch] Avoid taking global tasklist_lock for single threaded process at getrusage()
On Wed, 21 Dec 2005, Ravikiran G Thirumalai wrote:

> We did look at that. Cases RUSAGE_CHILDREN and RUSAGE_SELF are always called by the
> current task, so we can avoid tasklist locking there.
> getrusage for non-current tasks are always called with RUSAGE_BOTH.
> We ensure we always take the siglock for RUSAGE_BOTH case, so that the
> p->signal* fields are protected and take the tasklist_lock only if we have
> to traverse the tasklist hashlist. Isn't this safe?

Sounds okay. But its complex in the way its is coded now and its easy to
assume that one can call getrusage with any parameter from inside the
kernel. Maybe we can have a couple of separate functions

rusage_children()
rusage_self()
rusage_both()

?

Only rusage_both would take a task_struct * parameter. The others would
only operate on current. Change all the locations that call getrusage with
RUSAGE_BOTH to call rusage_both().
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-12-21 22:24    [W:0.045 / U:0.600 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site