mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sripathi Kodi <sripathik@in.ibm.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Vinay Sridhar <vinay@linux.vnet.ibm.com>,
	linux-kernel@vger.kernel.org, libc-alpha@sourceware.org,
	drepper@redhat.com, wli@holomorphy.com,
	"Eric W. Biederman" <ebiederm@xmission.com>,
	Pavel Emelyanov <xemul@openvz.org>
Subject: Re: [RFC] Per-thread getrusage
Date: Mon, 28 Jan 2008 13:54:12 +0530	[thread overview]
Message-ID: <200801281354.12387.sripathik@in.ibm.com> (raw)
In-Reply-To: <20080127215242.b873c341.akpm@linux-foundation.org>

Hi Andrew,

On Monday 28 January 2008 11:22, Andrew Morton wrote:
> 	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?

The code was only meant to be a base for discussions. It surely needs 
work. Our idea for the final version was to be able to read a thread's 
rusage from another thread strictly within the same process. The idea 
came from applications that need a cost enforcement mechanism. Having a 
mechanism for a thread to read it's own usage is essential. If there is 
a way to read other threads' rusage, it is even better.

Does Roland's patch (http://lkml.org/lkml/2008/1/18/589) look good to go 
in, provided Ulrich's comment (http://lkml.org/lkml/2008/1/19/15) is 
addressed?

Thanks,
Sripathi.

  parent reply	other threads:[~2008-01-28  8:24 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-17  8:27 Vinay Sridhar
2008-01-17 15:42 ` Ulrich Drepper
2008-01-19  1:14 ` Roland McGrath
2008-01-19  1:14 ` [PATCH] RUSAGE_THREAD Roland McGrath
2008-01-19  6:21   ` Ulrich Drepper
2008-01-21  9:55   ` Christoph Hellwig
2008-01-26  7:23   ` Michael Kerrisk
2008-01-28  5:52 ` [RFC] Per-thread getrusage Andrew Morton
2008-01-28  7:48   ` Pavel Emelyanov
2008-01-28  9:10     ` Andrew Morton
2008-01-28  9:38       ` Pavel Emelyanov
2008-01-28  9:45         ` Andrew Morton
2008-01-28  9:57           ` Pavel Emelyanov
2008-01-28 20:43             ` Eric W. Biederman
2008-01-28 21:57               ` Andrew Morton
2008-01-29  8:17                 ` Pavel Emelyanov
2008-01-29  8:29               ` Pavel Emelyanov
2008-01-28  8:24   ` Sripathi Kodi [this message]
2008-01-28  9:22     ` Andrew Morton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200801281354.12387.sripathik@in.ibm.com \
    --to=sripathik@in.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=drepper@redhat.com \
    --cc=ebiederm@xmission.com \
    --cc=libc-alpha@sourceware.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vinay@linux.vnet.ibm.com \
    --cc=wli@holomorphy.com \
    --cc=xemul@openvz.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome