This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [RFC] Per-thread getrusage
- From: Andrew Morton <akpm at linux-foundation dot org>
- To: Vinay Sridhar <vinay at linux dot vnet dot ibm dot com>
- Cc: linux-kernel at vger dot kernel dot org, libc-alpha at sourceware dot org, drepper at redhat dot com, wli at holomorphy dot com, sripathik at in dot ibm dot com, "Eric W. Biederman" <ebiederm at xmission dot com>, Pavel Emelyanov <xemul at openvz dot org>
- Date: Sun, 27 Jan 2008 21:52:42 -0800
- Subject: Re: [RFC] Per-thread getrusage
- References: <1200558425.5992.17.camel@srivinay.in.ibm.com>
On Thu, 17 Jan 2008 13:57:05 +0530 Vinay Sridhar <vinay@linux.vnet.ibm.com> wrote:
> Hi All,
>
> Last year, there was discussion about per-thread getrusage by adding
> RUSAGE_THREAD flag to getrusage(). Please refer to the thread
> http://lkml.org/lkml/2007/4/4/308. Ulrich had suggested that we should
> design a better user-space API. Specifically, we need a
> pthread_getrusage interface in the thread library, which accepts
> pthread_t, converts pthread_t into the corresponding tid and passes it
> down to the syscall.
>
> There are two ways to implement this in the kernel:
> 1) Introduce an additional parameter 'tid' to sys_getrusage() and put
> code in glibc to handle getrusage() and pthread_getrusage() calls
> correctly.
> 2) Introduce a new system call to handle pthread_getrusage() and leave
> sys_getrusage() untouched.
>
> We implemented the second idea above, simply because it avoids touching
> any existing code. We have implemented a new syscall, thread_getrusage()
> and we have exposed pthread_getrusage() API to applications.
>
> Could you please share your thoughts on this? Does the approach look
> alright? The code is hardly complete. It is just a prototype that works
> on IA32 at the moment.
>
> ...
>
> +asmlinkage long sys_thread_getrusage(int tid, struct rusage __user *ru);
What happens if `tid' refers to a thread in a different pid namespace?